forked from premiere/premiere-libtorrent
fix issue in web_peer_connection when the combined header size + chunk headers exceeds 1 kB
This commit is contained in:
parent
bc041a9a6d
commit
00aa80a5fd
|
@ -299,7 +299,7 @@ namespace libtorrent
|
|||
if (associated_torrent().expired()) return false;
|
||||
TORRENT_ASSERT(m_block_pos >= front_request.length);
|
||||
m_block_pos -= front_request.length;
|
||||
cut_receive_buffer(m_body_start, t->block_size() + 1024);
|
||||
cut_receive_buffer(m_body_start, t->block_size() + 5000);
|
||||
m_body_start = 0;
|
||||
recv_buffer = receive_buffer();
|
||||
// TORRENT_ASSERT(m_received_body <= range_end - range_start);
|
||||
|
@ -615,7 +615,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(chunk_size != 0 || chunk_start.left() <= header_size || chunk_start.begin[header_size] == 'H');
|
||||
// cut out the chunk header from the receive buffer
|
||||
TORRENT_ASSERT(m_body_start + m_chunk_pos < INT_MAX);
|
||||
cut_receive_buffer(header_size, t->block_size() + 1024, int(m_body_start + m_chunk_pos));
|
||||
cut_receive_buffer(header_size, t->block_size() + 5000, int(m_body_start + m_chunk_pos));
|
||||
recv_buffer = receive_buffer();
|
||||
recv_buffer.begin += m_body_start;
|
||||
m_chunk_pos += chunk_size;
|
||||
|
@ -750,7 +750,7 @@ namespace libtorrent
|
|||
m_received_body += r.length;
|
||||
TORRENT_ASSERT(receive_buffer().begin + m_body_start == recv_buffer.begin);
|
||||
TORRENT_ASSERT(m_received_body <= range_end - range_start);
|
||||
cut_receive_buffer(m_body_start + r.length, t->block_size() + 1024);
|
||||
cut_receive_buffer(m_body_start + r.length, t->block_size() + 5000);
|
||||
if (m_chunk_pos > 0)
|
||||
{
|
||||
TORRENT_ASSERT(m_chunk_pos >= r.length);
|
||||
|
@ -797,7 +797,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(receive_buffer().left() < size_to_cut + 1
|
||||
|| receive_buffer()[size_to_cut] == 'H');
|
||||
|
||||
cut_receive_buffer(size_to_cut, t->block_size() + 1024);
|
||||
cut_receive_buffer(size_to_cut, t->block_size() + 5000);
|
||||
if (m_chunk_pos > 0)
|
||||
{
|
||||
TORRENT_ASSERT(m_chunk_pos >= size_to_cut);
|
||||
|
|
|
@ -105,17 +105,20 @@ bool print_alerts(libtorrent::session& ses, char const* name
|
|||
TEST_CHECK(alert_cast<fastresume_rejected_alert>(*i) == 0 || allow_failed_fastresume);
|
||||
|
||||
peer_error_alert* pea = alert_cast<peer_error_alert>(*i);
|
||||
TEST_CHECK(pea == 0
|
||||
|| (!handles.empty() && h.status().is_seeding)
|
||||
|| pea->error.message() == "connecting to peer"
|
||||
|| pea->error.message() == "closing connection to ourself"
|
||||
|| pea->error.message() == "duplicate connection"
|
||||
|| pea->error.message() == "duplicate peer-id"
|
||||
|| pea->error.message() == "upload to upload connection"
|
||||
|| pea->error.message() == "stopping torrent"
|
||||
|| (allow_disconnects && pea->error.message() == "Broken pipe")
|
||||
|| (allow_disconnects && pea->error.message() == "Connection reset by peer")
|
||||
|| (allow_disconnects && pea->error.message() == "End of file."));
|
||||
if (pea)
|
||||
{
|
||||
fprintf(stderr, "peer error: %s\n", pea->error.message().c_str());
|
||||
TEST_CHECK((!handles.empty() && h.status().is_seeding)
|
||||
|| pea->error.message() == "connecting to peer"
|
||||
|| pea->error.message() == "closing connection to ourself"
|
||||
|| pea->error.message() == "duplicate connection"
|
||||
|| pea->error.message() == "duplicate peer-id"
|
||||
|| pea->error.message() == "upload to upload connection"
|
||||
|| pea->error.message() == "stopping torrent"
|
||||
|| (allow_disconnects && pea->error.message() == "Broken pipe")
|
||||
|| (allow_disconnects && pea->error.message() == "Connection reset by peer")
|
||||
|| (allow_disconnects && pea->error.message() == "End of file."));
|
||||
}
|
||||
delete *i;
|
||||
}
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue