fast piece optimization

This commit is contained in:
Arvid Norberg 2010-02-21 09:07:09 +00:00
parent 278c1f91c0
commit cebb0b8212
2 changed files with 16 additions and 2 deletions

View File

@ -105,6 +105,7 @@
* added info_hash to torrent_deleted_alert * added info_hash to torrent_deleted_alert
* improved LSD performance and made the interval configurable * improved LSD performance and made the interval configurable
* improved UDP tracker support by caching connect tokens * improved UDP tracker support by caching connect tokens
* fast piece optimization
* fixed issue with disk read cache not being cleared when removing torrents * fixed issue with disk read cache not being cleared when removing torrents
release 0.14.9 release 0.14.9

View File

@ -559,6 +559,15 @@ namespace libtorrent
return; return;
} }
if (upload_only())
{
#ifdef TORRENT_VERBOSE_LOGGING
(*m_logger) << time_now_string()
<< " *** SKIPPING ALLOWED SET BECAUSE PEER IS UPLOAD ONLY\n";
#endif
return;
}
int num_allowed_pieces = m_ses.settings().allowed_fast_set_size; int num_allowed_pieces = m_ses.settings().allowed_fast_set_size;
if (num_allowed_pieces == 0) return; if (num_allowed_pieces == 0) return;
@ -571,6 +580,10 @@ namespace libtorrent
// an allowed fast message for every single piece // an allowed fast message for every single piece
for (int i = 0; i < num_pieces; ++i) for (int i = 0; i < num_pieces; ++i)
{ {
// there's no point in offering fast pieces
// that the peer already has
if (has_piece(i)) continue;
#ifdef TORRENT_VERBOSE_LOGGING #ifdef TORRENT_VERBOSE_LOGGING
(*m_logger) << time_now_string() (*m_logger) << time_now_string()
<< " ==> ALLOWED_FAST [ " << i << " ]\n"; << " ==> ALLOWED_FAST [ " << i << " ]\n";