a bunch of fixes to make test_web_seeds a lot faster, and fail slightly fewer tests

This commit is contained in:
Arvid Norberg
2013-08-19 03:54:45 +00:00
parent 61be6b6ec8
commit 1afc0c6740
12 changed files with 172 additions and 102 deletions

View File

@@ -2462,7 +2462,14 @@ namespace libtorrent
if (info.state == block_info::state_finished) return;
TORRENT_ASSERT(info.num_peers == 0);
info.peer = peer;
// peers may have been disconnected in between mark_as_writing
// and mark_as_finished. When a peer disconnects, its m_peer_info
// pointer is set to NULL. If so, preserve the previous peer
// pointer, instead of forgetting who we downloaded this block from
if (info.state != block_info::state_writing || peer != 0)
info.peer = peer;
TORRENT_ASSERT(info.state == block_info::state_writing
|| peer == 0);
TORRENT_ASSERT(i->writing >= 0);