added log to on_ip_change and notify if ip_notifier is not supported (#1785)

added log to on_ip_change and notify if ip_notifier is not supported
This commit is contained in:
Alden Torres 2017-03-07 00:15:11 -05:00 committed by Arvid Norberg
parent 8cd0bb6eb3
commit eb39717b92
2 changed files with 10 additions and 4 deletions

View File

@ -91,7 +91,7 @@ namespace libtorrent
{ cb(error_code(err, system_category())); }); { cb(error_code(err, system_category())); });
} }
#else #else
TORRENT_UNUSED(cb); cb(make_error_code(boost::system::errc::not_supported));
#endif #endif
} }

View File

@ -1763,6 +1763,12 @@ namespace aux {
void session_impl::on_ip_change(error_code const& ec) void session_impl::on_ip_change(error_code const& ec)
{ {
#ifndef TORRENT_DISABLE_LOGGING
if (!ec)
session_log("received ip change from internal ip_notifier");
else
session_log("received error on_ip_change: %d, %s", ec.value(), ec.message().c_str());
#endif
if (ec || m_abort) return; if (ec || m_abort) return;
m_ip_notifier.async_wait([this] (error_code const& e) m_ip_notifier.async_wait([this] (error_code const& e)
{ this->wrap(&session_impl::on_ip_change, e); }); { this->wrap(&session_impl::on_ip_change, e); });
@ -1778,7 +1784,7 @@ namespace aux {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(!m_abort); TORRENT_ASSERT(!m_abort);
int flags = m_settings.get_bool(settings_pack::listen_system_port_fallback) int const flags = m_settings.get_bool(settings_pack::listen_system_port_fallback)
? 0 : listen_no_system_port; ? 0 : listen_no_system_port;
m_stats_counters.set_value(counters::has_incoming_connections, 0); m_stats_counters.set_value(counters::has_incoming_connections, 0);
@ -1871,7 +1877,7 @@ namespace aux {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
if (should_log()) if (should_log())
{ {
session_log("Closing listen socket for %s on device \"%s\"" session_log("closing listen socket for %s on device \"%s\""
, print_endpoint(remove_iter->local_endpoint).c_str() , print_endpoint(remove_iter->local_endpoint).c_str()
, remove_iter->device.c_str()); , remove_iter->device.c_str());
} }