From 7cfc0b2e4478f97624bd0908bd947ef4fc308322 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 29 Sep 2005 23:31:39 +0000 Subject: [PATCH] fixed bug introduced when adding the separate request queue --- src/peer_connection.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 548dc1725..07e916430 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1492,9 +1492,18 @@ namespace libtorrent std::deque::iterator it = std::find(m_download_queue.begin(), m_download_queue.end(), block); - assert(it != m_download_queue.end()); + if (it == m_download_queue.end()) + { + it = std::find(m_request_queue.begin(), m_request_queue.end(), block); + assert(it != m_request_queue.end()); + if (it == m_request_queue.end()) return; + m_request_queue.erase(it); + } + else + { + m_download_queue.erase(it); + } - m_download_queue.erase(it); send_block_requests(); int block_offset = block.block_index * m_torrent->block_size();