Merge pull request #541 from arvidn/fix-test-transfer-1.1

improve message from listen_failed_alert
This commit is contained in:
Arvid Norberg 2016-03-14 21:43:34 -04:00
commit 82d177472e
3 changed files with 22 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,21 @@ 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);
// update the actual port m_listen_interface was derived from also
if (!m_listen_interfaces.empty())
m_listen_interfaces[0].second += 1;
--listen_port_retries;
goto retry;
}
return;
}
@ -2119,12 +2122,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 +2130,15 @@ retry:
, listen_failed_alert::bind
, ec, listen_failed_alert::udp);
}
if (listen_port_retries > 0)
{
m_listen_interface.port(m_listen_interface.port() + 1);
// update the actual port m_listen_interface was derived from also
if (!m_listen_interfaces.empty())
m_listen_interfaces[0].second += 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)));
}
}