From bb409c5ee98f7545cb87fa31562c30405dc14d2d Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 23 Oct 2017 06:36:51 -0400 Subject: [PATCH] missing return if error in session_impl::on_port_mapping, doc typo (#2459) --- include/libtorrent/aux_/session_impl.hpp | 2 +- src/session_impl.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 12945c34e..39e704a0d 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -141,7 +141,7 @@ namespace aux { // listen_socket_t should not be copied or moved because // references to it are held by the DHT and tracker announce // code. That code expects a listen_socket_t to always refer - // to the same socket. It would be easy to accidently + // to the same socket. It would be easy to accidentally // invalidate that assumption if copying or moving were allowed. listen_socket_t(listen_socket_t const&) = delete; listen_socket_t(listen_socket_t&&) = delete; diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 88a14f9d1..a53c0ce9d 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -5413,10 +5413,14 @@ namespace { { TORRENT_ASSERT(is_single_thread()); - if (ec && m_alerts.should_post()) + if (ec) { - m_alerts.emplace_alert(mapping - , transport, ec); + if (m_alerts.should_post()) + { + m_alerts.emplace_alert(mapping + , transport, ec); + } + return; } // look through our listen sockets to see if this mapping is for one of @@ -5447,7 +5451,7 @@ namespace { else (*ls)->udp_external_port = port; } - if (!ec && m_alerts.should_post()) + if (m_alerts.should_post()) { m_alerts.emplace_alert(mapping, port , transport, proto);