graceful shutdown of uTP sockets

This commit is contained in:
Arvid Norberg 2012-01-23 05:02:12 +00:00
parent dce8b3cc1a
commit 1a32205944
2 changed files with 11 additions and 1 deletions

View File

@ -82,6 +82,7 @@ namespace libtorrent
void mtu_for_dest(address const& addr, int& link_mtu, int& utp_mtu);
void set_sock_buf(int size);
int num_sockets() const { return m_utp_sockets.size(); }
private:
udp_socket& m_sock;

View File

@ -2902,7 +2902,16 @@ namespace aux {
#if defined TORRENT_VERBOSE_LOGGING
// (*m_logger) << time_now_string() << " session_impl::on_tick\n";
#endif
if (m_abort) return;
// we have to keep ticking the utp socket manager
// until they're all closed
if (m_abort && m_utp_socket_manager.num_sockets() == 0)
{
#if defined TORRENT_ASIO_DEBUGGING
fprintf(stderr, "uTP sockets left: %d\n", m_utp_socket_manager.num_sockets());
#endif
return;
}
if (e == asio::error::operation_aborted) return;