improve message from listen_failed_alert. Post listen_failed_alert for every failure, including the ones that are re-tried

This commit is contained in:
arvidn 2016-03-13 16:18:44 -04:00
parent 108dfacd4d
commit fb85e5e60f
3 changed files with 16 additions and 15 deletions

View File

@ -861,8 +861,9 @@ namespace libtorrent {
"accept"
};
char ret[300];
snprintf(ret, sizeof(ret), "listening on %s failed: [%s] [%s] %s"
snprintf(ret, sizeof(ret), "listening on %s : %s failed: [%s] [%s] %s"
, listen_interface()
, print_endpoint(endpoint).c_str()
, op_str[operation]
, sock_type_str[sock_type]
, convert_from_native(error.message()).c_str());

View File

@ -2048,18 +2048,18 @@ retry:
session_log("cannot bind TCP listen socket to interface \"%s\": %s"
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
#endif
if (listen_port_retries > 0)
{
m_listen_interface.port(m_listen_interface.port() + 1);
--listen_port_retries;
goto retry;
}
if (m_alerts.should_post<listen_failed_alert>())
m_alerts.emplace_alert<listen_failed_alert>(
m_listen_interface.address().to_string()
, m_listen_interface.port()
, listen_failed_alert::bind
, ec, listen_failed_alert::tcp);
if (listen_port_retries > 0)
{
m_listen_interface.port(m_listen_interface.port() + 1);
--listen_port_retries;
goto retry;
}
return;
}
@ -2119,12 +2119,6 @@ retry:
session_log("cannot bind to UDP interface \"%s\": %s"
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
#endif
if (listen_port_retries > 0)
{
m_listen_interface.port(m_listen_interface.port() + 1);
--listen_port_retries;
goto retry;
}
if (m_alerts.should_post<listen_failed_alert>())
{
error_code err;
@ -2133,6 +2127,12 @@ retry:
, listen_failed_alert::bind
, ec, listen_failed_alert::udp);
}
if (listen_port_retries > 0)
{
m_listen_interface.port(m_listen_interface.port() + 1);
--listen_port_retries;
goto retry;
}
return;
}
else

View File

@ -363,9 +363,9 @@ void wait_for_downloading(lt::session& ses, char const* name)
} while (a);
if (!downloading_done)
{
fprintf(stderr, "did not receive a state_changed_alert indicating "
fprintf(stderr, "%s: did not receive a state_changed_alert indicating "
"the torrent is downloading. waited: %d ms\n"
, int(total_milliseconds(clock_type::now() - start)));
, name, int(total_milliseconds(clock_type::now() - start)));
}
}