forked from premiere/premiere-libtorrent
web seed downloader fix
This commit is contained in:
parent
d964abda7a
commit
89d65dcb15
|
@ -413,6 +413,8 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
recv_buffer.begin += m_body_start;
|
||||
// we only received the header, no data
|
||||
if (recv_buffer.left() == 0) break;
|
||||
|
||||
size_type range_start;
|
||||
size_type range_end;
|
||||
|
@ -548,13 +550,15 @@ namespace libtorrent
|
|||
int copy_size = std::min(std::min(m_requests.front().length - piece_size
|
||||
, recv_buffer.left()), int(range_end - range_start - m_received_body));
|
||||
assert(copy_size >= 0);
|
||||
m_piece.resize(piece_size + copy_size);
|
||||
if (copy_size > 0)
|
||||
{
|
||||
m_piece.resize(piece_size + copy_size);
|
||||
std::memcpy(&m_piece[0] + piece_size, recv_buffer.begin, copy_size);
|
||||
recv_buffer.begin += copy_size;
|
||||
m_received_body += copy_size;
|
||||
m_body_start += copy_size;
|
||||
assert(m_received_body <= range_end - range_start);
|
||||
recv_buffer.begin += copy_size;
|
||||
m_received_body += copy_size;
|
||||
m_body_start += copy_size;
|
||||
}
|
||||
assert(m_received_body == range_end - range_start);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue