forked from premiere/premiere-libtorrent
fix typo in validation of reject messages. Make on_choke a bit more defensive
This commit is contained in:
parent
38ca4113ea
commit
bb5c612180
|
@ -810,12 +810,12 @@ namespace {
|
|||
// pretend that we received reject request messages
|
||||
std::shared_ptr<torrent> t = associated_torrent().lock();
|
||||
TORRENT_ASSERT(t);
|
||||
while (!download_queue().empty())
|
||||
auto const dlq = download_queue();
|
||||
for (pending_block const& pb : dlq)
|
||||
{
|
||||
piece_block const& b = download_queue().front().block;
|
||||
peer_request r;
|
||||
r.piece = b.piece_index;
|
||||
r.start = b.block_index * t->block_size();
|
||||
r.piece = pb.block.piece_index;
|
||||
r.start = pb.block.block_index * t->block_size();
|
||||
r.length = t->block_size();
|
||||
// if it's the last piece, make sure to
|
||||
// set the length of the request to not
|
||||
|
|
|
@ -1521,7 +1521,7 @@ namespace libtorrent {
|
|||
if (r.piece < piece_index_t{}
|
||||
|| r.piece >= t->torrent_file().files().end_piece()
|
||||
|| r.start < 0
|
||||
|| r.start >= block_size
|
||||
|| r.start >= t->torrent_file().piece_length()
|
||||
|| (r.start % block_size) != 0
|
||||
|| r.length != std::min(t->torrent_file().piece_size(r.piece) - r.start, block_size))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue