From 971ead4a440414af7315b703a469b757a90110e0 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 12 May 2008 06:25:53 +0000 Subject: [PATCH] made redundant connction closing optional (defaults to on) --- docs/manual.rst | 6 ++++++ src/peer_connection.cpp | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/manual.rst b/docs/manual.rst index 6976d2973..fc8c0a868 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -2820,6 +2820,7 @@ that will be sent to the tracker. The user-agent is a good way to identify your float share_ratio_limit; float seed_time_ratio_limit; int seed_time_limit; + bool close_redundant_connections; }; ``user_agent`` this is the client identification to the tracker. @@ -3040,6 +3041,11 @@ for considering a seeding torrent to have met the seed limit criteria. See queui (specified in seconds) before it is considered having met the seed limit criteria. See queuing_. +``close_redundant_connections`` specifies whether libtorrent should close +connections where both ends have no utility in keeping the connection open. +For instance if both ends have completed their downloads, there's no point +in keeping it open. This defaults to ``true``. + pe_settings =========== diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 4acd4fca8..6b40e9cc2 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1109,7 +1109,7 @@ namespace libtorrent { TORRENT_ASSERT(m_peer_info); m_peer_info->seed = true; - if (t->is_finished()) + if (t->is_finished() && m_ses.settings().close_redundant_connections) { disconnect("seed to seed connection redundant"); return; @@ -1186,7 +1186,7 @@ namespace libtorrent // if this is a web seed. we don't have a peer_info struct if (m_peer_info) m_peer_info->seed = true; // if we're a seed too, disconnect - if (t->is_finished()) + if (t->is_finished() && m_ses.settings().close_redundant_connections) { disconnect("seed to seed connection redundant, disconnecting"); return; @@ -1751,7 +1751,7 @@ namespace libtorrent #endif // if we're a seed too, disconnect - if (t->is_finished()) + if (t->is_finished() && m_ses.settings().close_redundant_connections) { disconnect("seed to seed connection redundant, disconnecting"); return;