made torrents not wanting more peers whene they're shutting down. Closes out all connections in the connection queue explicitly when session is shutting down

This commit is contained in:
Arvid Norberg
2008-10-30 17:13:10 +00:00
parent afb6b55b8f
commit 4dada930ac
4 changed files with 36 additions and 2 deletions

View File

@@ -498,6 +498,12 @@ namespace aux {
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " aborting all connections (" << m_connections.size() << ")\n";
#endif
m_half_open.close();
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " connection queue: " << m_half_open.size() << std::endl;
#endif
// abort all connections
while (!m_connections.empty())
{
@@ -508,10 +514,14 @@ namespace aux {
TORRENT_ASSERT(conn == int(m_connections.size()) + 1);
}
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " connection queue: " << m_half_open.size() << std::endl;
#endif
TORRENT_ASSERT(m_half_open.size() == 0);
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " shutting down connection queue\n";
#endif
m_half_open.close();
m_download_channel.close();
m_upload_channel.close();
@@ -2270,6 +2280,7 @@ namespace aux {
(*m_logger) << time_now_string() << "\n\n *** shutting down session *** \n\n";
#endif
abort();
TORRENT_ASSERT(m_connections.empty());
#ifndef TORRENT_DISABLE_GEO_IP
if (m_asnum_db) GeoIP_delete(m_asnum_db);
@@ -2292,6 +2303,7 @@ namespace aux {
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " shutdown complete!\n";
#endif
TORRENT_ASSERT(m_connections.empty());
}
void session_impl::set_max_uploads(int limit)