have optimization is now optional, but on by default

This commit is contained in:
Arvid Norberg 2007-05-25 21:19:14 +00:00
parent c10e74f4fc
commit 8679ee5916
2 changed files with 9 additions and 1 deletions

View File

@ -100,6 +100,7 @@ namespace libtorrent
, peer_connect_timeout(10) , peer_connect_timeout(10)
, ignore_limits_on_local_network(true) , ignore_limits_on_local_network(true)
, connection_speed(20) , connection_speed(20)
, send_redundant_have(false)
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
, use_dht_as_fallback(true) , use_dht_as_fallback(true)
#endif #endif
@ -212,6 +213,12 @@ namespace libtorrent
// are made per second. // are made per second.
int connection_speed; 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 #ifndef TORRENT_DISABLE_DHT
// while this is true, the dht will note be used unless the // while this is true, the dht will note be used unless the
// tracker is online // tracker is online

View File

@ -338,7 +338,8 @@ namespace libtorrent
{ {
// optimization, don't send have messages // optimization, don't send have messages
// to peers that already have the piece // 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 #ifdef TORRENT_VERBOSE_LOGGING
(*m_logger) << time_now_string() (*m_logger) << time_now_string()