keeps track of the number of requests waiting in the send buffer and adjusts bandwidht priority accordingly in the bandwidth limiter

This commit is contained in:
Arvid Norberg
2008-07-08 00:03:08 +00:00
parent a7ed5578b6
commit a20f1a8fa0
9 changed files with 47 additions and 17 deletions

View File

@@ -275,7 +275,7 @@ public:
// these functions encrypt the send buffer if m_rc4_encrypted
// is true, otherwise it passes the call to the
// peer_connection functions of the same names
void send_buffer(char* buf, int size);
void send_buffer(char* buf, int size, int flags = 0);
buffer::interval allocate_send_buffer(int size);
template <class Destructor>
void append_send_buffer(char* buffer, int size, Destructor const& destructor)

View File

@@ -409,7 +409,8 @@ namespace libtorrent
// these functions are virtual to let bt_peer_connection hook into them
// and encrypt the content
virtual void send_buffer(char const* begin, int size);
enum message_type_flags { message_type_request = 1 };
virtual void send_buffer(char const* begin, int size, int flags = 0);
virtual buffer::interval allocate_send_buffer(int size);
virtual void setup_send();
@@ -681,6 +682,10 @@ namespace libtorrent
// downloaded from this peer
std::vector<int> m_suggested_pieces;
// a list of byte offsets inside the send buffer
// the piece requests
std::vector<int> m_requests_in_buffer;
// the number of pieces this peer
// has. Must be the same as
// std::count(m_have_piece.begin(),

View File

@@ -143,6 +143,10 @@ namespace libtorrent
// for yet
int download_queue_length;
// the number of request messages
// waiting to be sent inside the send buffer
int requests_in_buffer;
// the number of requests that is
// tried to be maintained (this is
// typically a function of download speed)