From 8679ee5916fa0f5401ef5bd6a5a8ce14873ada21 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 25 May 2007 21:19:14 +0000 Subject: [PATCH] have optimization is now optional, but on by default --- include/libtorrent/session_settings.hpp | 7 +++++++ src/peer_connection.cpp | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/libtorrent/session_settings.hpp b/include/libtorrent/session_settings.hpp index 2fcc67a1a..86e527efd 100644 --- a/include/libtorrent/session_settings.hpp +++ b/include/libtorrent/session_settings.hpp @@ -100,6 +100,7 @@ namespace libtorrent , peer_connect_timeout(10) , ignore_limits_on_local_network(true) , connection_speed(20) + , send_redundant_have(false) #ifndef TORRENT_DISABLE_DHT , use_dht_as_fallback(true) #endif @@ -212,6 +213,12 @@ namespace libtorrent // are made per second. int connection_speed; + // if this is set to true, have messages will be sent + // to peers that already have the piece. This is + // typically not necessary, but it might be necessary + // for collecting statistics in some cases. Default is false. + bool send_redundant_have; + #ifndef TORRENT_DISABLE_DHT // while this is true, the dht will note be used unless the // tracker is online diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 7eb56921b..03ac9057d 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -338,7 +338,8 @@ namespace libtorrent { // optimization, don't send have messages // to peers that already have the piece - if (has_piece(index)) return; + if (!m_ses.settings().send_redundant_have + && has_piece(index)) return; #ifdef TORRENT_VERBOSE_LOGGING (*m_logger) << time_now_string()