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
|
// sends a cancel message if appropriate
|
||||||
// refills the request queue, and possibly ignoring pieces requested
|
// refills the request queue, and possibly ignoring pieces requested
|
||||||
// by peers in the ignore list (to avoid recursion)
|
// 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();
|
void send_block_requests();
|
||||||
|
|
||||||
int bandwidth_throttle(int channel) const
|
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;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
|
@ -2946,6 +2946,8 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(block_size > 0);
|
TORRENT_ASSERT(block_size > 0);
|
||||||
TORRENT_ASSERT(block_size <= t->block_size());
|
TORRENT_ASSERT(block_size <= t->block_size());
|
||||||
|
|
||||||
|
if (force) t->picker().abort_download(block, peer_info_struct());
|
||||||
|
|
||||||
if (m_outstanding_bytes < block_size) return;
|
if (m_outstanding_bytes < block_size) return;
|
||||||
|
|
||||||
peer_request r;
|
peer_request r;
|
||||||
|
|
Loading…
Reference in New Issue