better rate limiter fix

This commit is contained in:
Arvid Norberg 2010-02-21 01:32:57 +00:00
parent cead1b5780
commit 54b4bc7754
4 changed files with 1 additions and 10 deletions

View File

@ -195,12 +195,6 @@ namespace libtorrent
policy::peer* peer_info_struct() const
{ 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 };
peer_speed_t peer_speed();

View File

@ -287,8 +287,6 @@ namespace libtorrent { namespace
<< " ==> METADATA_REQUEST [ start: " << start << " | size: " << size << " ]\n";
#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);
detail::write_uint32(1 + 1 + 3, i.begin);

View File

@ -4172,7 +4172,7 @@ namespace libtorrent
TORRENT_ASSERT(m_outstanding_bytes >= 0);
m_channel_state[download_channel] = peer_info::bw_limit;
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);
}

View File

@ -324,7 +324,6 @@ namespace libtorrent { namespace
if (!m_torrent.valid_metadata())
{
write_metadata_packet(2, piece);
m_pc.extension_expect_bytes(0x4000);
return true;
}
// TODO: put the request on the queue in some cases