better rate limiter fix
This commit is contained in:
parent
cead1b5780
commit
54b4bc7754
|
@ -195,12 +195,6 @@ namespace libtorrent
|
||||||
policy::peer* peer_info_struct() const
|
policy::peer* peer_info_struct() const
|
||||||
{ return m_peer_info; }
|
{ return m_peer_info; }
|
||||||
|
|
||||||
// used by extensions to advertise that they expect to
|
|
||||||
// receive a number of bytes, this will make the peer
|
|
||||||
// connection request more download quota from the download
|
|
||||||
// rate limiter
|
|
||||||
void extension_expect_bytes(int n) { m_extension_outstanding_bytes += n; }
|
|
||||||
|
|
||||||
enum peer_speed_t { slow = 1, medium, fast };
|
enum peer_speed_t { slow = 1, medium, fast };
|
||||||
peer_speed_t peer_speed();
|
peer_speed_t peer_speed();
|
||||||
|
|
||||||
|
|
|
@ -287,8 +287,6 @@ namespace libtorrent { namespace
|
||||||
<< " ==> METADATA_REQUEST [ start: " << start << " | size: " << size << " ]\n";
|
<< " ==> METADATA_REQUEST [ start: " << start << " | size: " << size << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_pc.extension_expect_bytes(m_tp.metadata_size() == 0 ? 2048 : m_tp.metadata_size() * size / 255);
|
|
||||||
|
|
||||||
buffer::interval i = m_pc.allocate_send_buffer(9);
|
buffer::interval i = m_pc.allocate_send_buffer(9);
|
||||||
|
|
||||||
detail::write_uint32(1 + 1 + 3, i.begin);
|
detail::write_uint32(1 + 1 + 3, i.begin);
|
||||||
|
|
|
@ -4172,7 +4172,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(m_outstanding_bytes >= 0);
|
TORRENT_ASSERT(m_outstanding_bytes >= 0);
|
||||||
m_channel_state[download_channel] = peer_info::bw_limit;
|
m_channel_state[download_channel] = peer_info::bw_limit;
|
||||||
m_ses.m_download_rate.request_bandwidth(self()
|
m_ses.m_download_rate.request_bandwidth(self()
|
||||||
, (std::max)(m_outstanding_bytes, m_extension_outstanding_bytes) + 30
|
, (std::max)(m_outstanding_bytes, m_packet_size - m_recv_pos) + 30
|
||||||
, priority , bwc1, bwc2, bwc3, bwc4);
|
, priority , bwc1, bwc2, bwc3, bwc4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,6 @@ namespace libtorrent { namespace
|
||||||
if (!m_torrent.valid_metadata())
|
if (!m_torrent.valid_metadata())
|
||||||
{
|
{
|
||||||
write_metadata_packet(2, piece);
|
write_metadata_packet(2, piece);
|
||||||
m_pc.extension_expect_bytes(0x4000);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// TODO: put the request on the queue in some cases
|
// TODO: put the request on the queue in some cases
|
||||||
|
|
Loading…
Reference in New Issue