From 5ae55c5738e15321df837fcf0deeda46d61b4491 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 1 Sep 2006 09:36:43 +0000 Subject: [PATCH] fixed bug appearing when changing the sequenced download threshold on a torrent which already had some pieced downloaded. --- ChangeLog | 10 +++++++--- src/piece_picker.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ec5f4712..2c26844fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ - * fixed bug with file_progress() with files > 2 GB - * added --enable-examples option to configure script + * changed the address type to support IPv6 + * fixed in piece picker which would assert when changing + sequenced download threshold on torrents with already + downloaded pieces. + * fixed bug with file_progress() with files > 2 GB. + * added --enable-examples option to configure script. * fixed problem with the resource distribution algorithm - (controlling e.g upload/download rates) + (controlling e.g upload/download rates). * fixed incorrect asserts in storage related to torrents with zero-sized files. * added support for trackerless torrents (with kademlia DHT). diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 6a3aa8423..731c2c70d 100755 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -157,8 +157,9 @@ namespace libtorrent if (i->priority(old_limit) != i->priority(m_sequenced_download_threshold)) { piece_pos& p = *i; - int prev_priority = i->priority(old_limit); - move(p.downloading, p.filtered, prev_priority, i->index); + if (p.index == piece_pos::we_have_index) continue; + int prev_priority = p.priority(old_limit); + move(p.downloading, p.filtered, prev_priority, p.index); } } } @@ -378,6 +379,7 @@ namespace libtorrent assert(!filtered); assert(priority >= 0); assert(elem_index >= 0); + assert(elem_index != piece_pos::we_have_index); std::vector >& src_vec(pick_piece_info_vector( downloading, filtered));