revert early return in session_impl::on_port_mapping and only check for error if cast_vote (#2468)
This commit is contained in:
parent
6409cb42e1
commit
7216b69188
|
@ -5413,14 +5413,14 @@ namespace {
|
|||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
|
||||
if (ec)
|
||||
// NOTE: don't assume that if ec != 0, the rest of the logic
|
||||
// is not necessary, the ports still need to be set, in other
|
||||
// words, don't early return without careful review of the
|
||||
// remaining logic
|
||||
if (ec && m_alerts.should_post<portmap_error_alert>())
|
||||
{
|
||||
if (m_alerts.should_post<portmap_error_alert>())
|
||||
{
|
||||
m_alerts.emplace_alert<portmap_error_alert>(mapping
|
||||
, transport, ec);
|
||||
}
|
||||
return;
|
||||
m_alerts.emplace_alert<portmap_error_alert>(mapping
|
||||
, transport, ec);
|
||||
}
|
||||
|
||||
// look through our listen sockets to see if this mapping is for one of
|
||||
|
@ -5440,7 +5440,7 @@ namespace {
|
|||
|
||||
if (ls != m_listen_sockets.end())
|
||||
{
|
||||
if (ip != address())
|
||||
if (!ec && ip != address())
|
||||
{
|
||||
// TODO: 1 report the proper address of the router as the source IP of
|
||||
// this vote of our external address, instead of the empty address
|
||||
|
@ -5451,7 +5451,7 @@ namespace {
|
|||
else (*ls)->udp_external_port = port;
|
||||
}
|
||||
|
||||
if (m_alerts.should_post<portmap_alert>())
|
||||
if (!ec && m_alerts.should_post<portmap_alert>())
|
||||
{
|
||||
m_alerts.emplace_alert<portmap_alert>(mapping, port
|
||||
, transport, proto);
|
||||
|
|
Loading…
Reference in New Issue