forked from premiere/premiere-libtorrent
fix potential infinite loop in request_time_critical_pieces
This commit is contained in:
parent
f38f8c57c4
commit
6a4708ef15
|
@ -88,6 +88,7 @@
|
|||
incoming connection
|
||||
* added more detailed instrumentation of the disk I/O thread
|
||||
|
||||
* fix for set_piece_deadline
|
||||
* add reset_piece_deadline function
|
||||
* fix merkle tree torrent assert
|
||||
|
||||
|
|
|
@ -2745,6 +2745,10 @@ namespace libtorrent
|
|||
if ((int)m_download_queue.size() + (int)m_request_queue.size()
|
||||
> m_desired_queue_size * 2) return false;
|
||||
if (on_parole()) return false;
|
||||
if (m_disconnecting) return false;
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
TORRENT_ASSERT(t);
|
||||
if (t->upload_mode()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7037,6 +7037,8 @@ namespace libtorrent
|
|||
for (std::list<time_critical_piece>::iterator i = m_time_critical_pieces.begin()
|
||||
, end(m_time_critical_pieces.end()); i != end; ++i)
|
||||
{
|
||||
if (peers.empty()) break;
|
||||
|
||||
if (i != m_time_critical_pieces.begin() && i->deadline > now
|
||||
+ milliseconds(m_average_piece_time + m_piece_time_deviation * 4))
|
||||
{
|
||||
|
@ -7079,7 +7081,11 @@ namespace libtorrent
|
|||
}
|
||||
else if (!interesting_blocks.empty())
|
||||
{
|
||||
c.add_request(interesting_blocks.front(), peer_connection::req_time_critical);
|
||||
if (!c.add_request(interesting_blocks.front(), peer_connection::req_time_critical))
|
||||
{
|
||||
peers.erase(p);
|
||||
continue;
|
||||
}
|
||||
added_request = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue