added some asserts
This commit is contained in:
@@ -615,9 +615,13 @@ namespace libtorrent
|
|||||||
// be requested from other peers
|
// be requested from other peers
|
||||||
t->picker().abort_download(*i);
|
t->picker().abort_download(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_download_queue.clear();
|
||||||
|
m_request_queue.clear();
|
||||||
}
|
}
|
||||||
m_download_queue.clear();
|
|
||||||
m_request_queue.clear();
|
assert(m_download_queue.empty());
|
||||||
|
assert(m_request_queue.empty());
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// t->picker().integrity_check(m_torrent);
|
// t->picker().integrity_check(m_torrent);
|
||||||
@@ -1037,6 +1041,7 @@ namespace libtorrent
|
|||||||
// peer that has taken over it.
|
// peer that has taken over it.
|
||||||
boost::optional<tcp::endpoint> peer
|
boost::optional<tcp::endpoint> peer
|
||||||
= t->picker().get_downloader(block_finished);
|
= t->picker().get_downloader(block_finished);
|
||||||
|
assert(!t->picker().is_finished(block_finished));
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
peer_connection* pc = t->connection_for(*peer);
|
peer_connection* pc = t->connection_for(*peer);
|
||||||
@@ -1612,24 +1617,17 @@ namespace libtorrent
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
piece_picker& picker = t->picker();
|
piece_picker& picker = t->picker();
|
||||||
for (std::deque<piece_block>::const_iterator i = m_download_queue.begin()
|
while (!m_download_queue.empty())
|
||||||
, end(m_download_queue.end()); i != end; ++i)
|
|
||||||
{
|
{
|
||||||
// since this piece was skipped, clear it and allow it to
|
picker.abort_download(m_download_queue.back());
|
||||||
// be requested from other peers
|
m_download_queue.pop_back();
|
||||||
picker.abort_download(*i);
|
|
||||||
}
|
}
|
||||||
for (std::deque<piece_block>::const_iterator i = m_request_queue.begin()
|
while (!m_request_queue.empty())
|
||||||
, end(m_request_queue.end()); i != end; ++i)
|
|
||||||
{
|
{
|
||||||
// since this piece was skipped, clear it and allow it to
|
picker.abort_download(m_request_queue.back());
|
||||||
// be requested from other peers
|
m_request_queue.pop_back();
|
||||||
picker.abort_download(*i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_download_queue.clear();
|
|
||||||
m_request_queue.clear();
|
|
||||||
|
|
||||||
// TODO: If we have a limited number of upload
|
// TODO: If we have a limited number of upload
|
||||||
// slots, choke this peer
|
// slots, choke this peer
|
||||||
|
|
||||||
|
@@ -1172,7 +1172,7 @@ namespace libtorrent
|
|||||||
// clear this block as being downloaded
|
// clear this block as being downloaded
|
||||||
i->requested_blocks[block.block_index] = 0;
|
i->requested_blocks[block.block_index] = 0;
|
||||||
|
|
||||||
// if there are no other blocks in this pieces
|
// if there are no other blocks in this piece
|
||||||
// that's being downloaded, remove it from the list
|
// that's being downloaded, remove it from the list
|
||||||
if (i->requested_blocks.count() == 0)
|
if (i->requested_blocks.count() == 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user