fixed off-by-one error when receiving a piece which skipped a bunch of requests
This commit is contained in:
@@ -1639,7 +1639,7 @@ namespace libtorrent
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int block_index = b - m_download_queue.begin();
|
int block_index = b - m_download_queue.begin() - 1;
|
||||||
for (int i = 0; i < block_index; ++i)
|
for (int i = 0; i < block_index; ++i)
|
||||||
{
|
{
|
||||||
pending_block& qe = m_download_queue[i];
|
pending_block& qe = m_download_queue[i];
|
||||||
@@ -1660,6 +1660,7 @@ namespace libtorrent
|
|||||||
m_ses.m_alerts.post_alert(request_dropped_alert(t->get_handle()
|
m_ses.m_alerts.post_alert(request_dropped_alert(t->get_handle()
|
||||||
, remote(), pid(), qe.block.block_index, qe.block.piece_index));
|
, remote(), pid(), qe.block.block_index, qe.block.piece_index));
|
||||||
picker.abort_download(qe.block);
|
picker.abort_download(qe.block);
|
||||||
|
TORRENT_ASSERT(m_download_queue.begin() + i != b);
|
||||||
m_download_queue.erase(m_download_queue.begin() + i);
|
m_download_queue.erase(m_download_queue.begin() + i);
|
||||||
--i;
|
--i;
|
||||||
--block_index;
|
--block_index;
|
||||||
|
Reference in New Issue
Block a user