diff --git a/simulation/libsimulator b/simulation/libsimulator index 0151d5c17..66356b0ce 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit 0151d5c17fa3f4cf0ce518d0b8f90a23792c9b24 +Subproject commit 66356b0ce99cd126c7c99df50609b3050ba44e5d diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 02f4d101f..d845e3b70 100644 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -1893,21 +1893,15 @@ namespace libtorrent namespace { int append_blocks(std::vector& dst, std::vector& src - , int num_blocks) + , int const num_blocks) { if (src.empty()) return num_blocks; - int to_copy; -// if (prefer_contiguous_blocks == 0) - to_copy = (std::min)(int(src.size()), num_blocks); -// else -// to_copy = int(src.size()); + int const to_copy = (std::min)(int(src.size()), num_blocks); - dst.insert(dst.end() - , src.begin(), src.begin() + to_copy); - src.clear(); + dst.insert(dst.end(), src.begin(), src.begin() + to_copy); + src.erase(src.begin(), src.begin() + to_copy); return num_blocks - to_copy; } - } // lower availability comes first. This is a less-than comparison, it returns @@ -2338,8 +2332,7 @@ get_out: #endif ret |= picker_log_alert::backup1; - num_blocks = append_blocks(interesting_blocks, backup_blocks - , num_blocks); + num_blocks = append_blocks(interesting_blocks, backup_blocks, num_blocks); if (num_blocks <= 0) return ret; ret |= picker_log_alert::backup2; @@ -2390,7 +2383,7 @@ get_out: // we either don't have this piece, or we've already requested from it if (!pieces[dp.index]) continue; - // if we already have the piece, obviously we should not have + // if we already have the piece, obviously we should not have // since this is a partial piece in the piece_downloading state, we // should not already have it TORRENT_ASSERT(!m_piece_map[dp.index].have());