forked from premiere/premiere-libtorrent
fixed rare request queuing issue for peers in parole mode
This commit is contained in:
parent
95f543b43b
commit
b3372dced6
|
@ -1863,21 +1863,34 @@ namespace libtorrent
|
||||||
in_req_queue = true;
|
in_req_queue = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this is not in the request queue, we have to
|
// if this is not in the request queue, we have to
|
||||||
// assume our outstanding bytes includes this piece too
|
// assume our outstanding bytes includes this piece too
|
||||||
if (!in_req_queue)
|
if (!in_req_queue)
|
||||||
{
|
{
|
||||||
if (t->alerts().should_post<unwanted_block_alert>())
|
for (std::vector<piece_block>::iterator i = m_request_queue.begin()
|
||||||
|
, end(m_request_queue.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
t->alerts().post_alert(unwanted_block_alert(t->get_handle(), m_remote
|
if (*i != b) continue;
|
||||||
, m_peer_id, b.block_index, b.piece_index));
|
in_req_queue = true;
|
||||||
|
m_request_queue.erase(i);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!in_req_queue)
|
||||||
|
{
|
||||||
|
if (t->alerts().should_post<unwanted_block_alert>())
|
||||||
|
{
|
||||||
|
t->alerts().post_alert(unwanted_block_alert(t->get_handle(), m_remote
|
||||||
|
, m_peer_id, b.block_index, b.piece_index));
|
||||||
|
}
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
(*m_logger) << " *** The block we just got was not in the "
|
(*m_logger) << " *** The block we just got was not in the "
|
||||||
"request queue ***\n";
|
"request queue ***\n";
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
m_download_queue.insert(m_download_queue.begin(), b);
|
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;
|
m_outstanding_bytes += r.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue