forked from premiere/premiere-libtorrent
add a force-flag to cancel_request
This commit is contained in:
parent
42a5185f24
commit
d6a53200a2
|
@ -506,7 +506,9 @@ namespace libtorrent
|
|||
// sends a cancel message if appropriate
|
||||
// refills the request queue, and possibly ignoring pieces requested
|
||||
// by peers in the ignore list (to avoid recursion)
|
||||
void cancel_request(piece_block const& b);
|
||||
// if force is true, the blocks is also freed from the piece
|
||||
// picker, allowing another peer to request it immediately
|
||||
void cancel_request(piece_block const& b, bool force = false);
|
||||
void send_block_requests();
|
||||
|
||||
int bandwidth_throttle(int channel) const
|
||||
|
|
|
@ -2898,7 +2898,7 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
void peer_connection::cancel_request(piece_block const& block)
|
||||
void peer_connection::cancel_request(piece_block const& block, bool force)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
@ -2946,6 +2946,8 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(block_size > 0);
|
||||
TORRENT_ASSERT(block_size <= t->block_size());
|
||||
|
||||
if (force) t->picker().abort_download(block, peer_info_struct());
|
||||
|
||||
if (m_outstanding_bytes < block_size) return;
|
||||
|
||||
peer_request r;
|
||||
|
|
Loading…
Reference in New Issue