fixed rare request queuing issue for peers in parole mode

This commit is contained in:
Arvid Norberg 2009-08-28 07:48:31 +00:00
parent 95f543b43b
commit b3372dced6
1 changed files with 19 additions and 6 deletions

View File

@ -1863,8 +1863,20 @@ namespace libtorrent
in_req_queue = true;
break;
}
// if this is not in the request queue, we have to
// assume our outstanding bytes includes this piece too
if (!in_req_queue)
{
for (std::vector<piece_block>::iterator i = m_request_queue.begin()
, end(m_request_queue.end()); i != end; ++i)
{
if (*i != b) continue;
in_req_queue = true;
m_request_queue.erase(i);
break;
}
if (!in_req_queue)
{
if (t->alerts().should_post<unwanted_block_alert>())
@ -1876,8 +1888,9 @@ namespace libtorrent
(*m_logger) << " *** The block we just got was not in the "
"request queue ***\n";
#endif
}
m_download_queue.insert(m_download_queue.begin(), b);
m_download_queue.front().not_wanted = true;
if (!in_req_queue) m_download_queue.front().not_wanted = true;
m_outstanding_bytes += r.length;
}
}