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
* improved LSD performance and made the interval configurable
* improved UDP tracker support by caching connect tokens
* fast piece optimization
* fixed issue with disk read cache not being cleared when removing torrents
release 0.14.9

View File

@ -559,6 +559,15 @@ namespace libtorrent
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;
if (num_allowed_pieces == 0) return;
@ -571,9 +580,13 @@ namespace libtorrent
// an allowed fast message for every single piece
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
(*m_logger) << time_now_string()
<< " ==> ALLOWED_FAST [ " << i << " ]\n";
(*m_logger) << time_now_string()
<< " ==> ALLOWED_FAST [ " << i << " ]\n";
#endif
write_allow_fast(i);
TORRENT_ASSERT(std::find(m_accept_fast.begin()