(trunk libT) remove tr_peermsgs.minActiveRequests based on wereHamster's feedback
This commit is contained in:
parent
8556ce653f
commit
2b0ece7614
|
@ -280,7 +280,6 @@ struct tr_peermsgs
|
||||||
uint8_t ut_pex_id;
|
uint8_t ut_pex_id;
|
||||||
uint16_t pexCount;
|
uint16_t pexCount;
|
||||||
uint16_t pexCount6;
|
uint16_t pexCount6;
|
||||||
uint16_t minActiveRequests;
|
|
||||||
uint16_t maxActiveRequests;
|
uint16_t maxActiveRequests;
|
||||||
|
|
||||||
size_t fastsetSize;
|
size_t fastsetSize;
|
||||||
|
@ -903,13 +902,10 @@ static void
|
||||||
pumpRequestQueue( tr_peermsgs * msgs, const time_t now )
|
pumpRequestQueue( tr_peermsgs * msgs, const time_t now )
|
||||||
{
|
{
|
||||||
const int max = msgs->maxActiveRequests;
|
const int max = msgs->maxActiveRequests;
|
||||||
const int min = msgs->minActiveRequests;
|
|
||||||
int sent = 0;
|
int sent = 0;
|
||||||
int count = msgs->clientAskedFor.count;
|
int count = msgs->clientAskedFor.count;
|
||||||
struct peer_request req;
|
struct peer_request req;
|
||||||
|
|
||||||
if( count > min )
|
|
||||||
return;
|
|
||||||
if( msgs->peer->clientIsChoked )
|
if( msgs->peer->clientIsChoked )
|
||||||
return;
|
return;
|
||||||
if( !tr_torrentIsPieceTransferAllowed( msgs->torrent, TR_PEER_TO_CLIENT ) )
|
if( !tr_torrentIsPieceTransferAllowed( msgs->torrent, TR_PEER_TO_CLIENT ) )
|
||||||
|
@ -1768,10 +1764,10 @@ ratePulse( void * vmsgs )
|
||||||
tr_peermsgs * msgs = vmsgs;
|
tr_peermsgs * msgs = vmsgs;
|
||||||
const double rateToClient = tr_peerGetPieceSpeed( msgs->peer, TR_PEER_TO_CLIENT );
|
const double rateToClient = tr_peerGetPieceSpeed( msgs->peer, TR_PEER_TO_CLIENT );
|
||||||
const int seconds = 10;
|
const int seconds = 10;
|
||||||
|
const int floor = 8;
|
||||||
const int estimatedBlocksInPeriod = ( rateToClient * seconds * 1024 ) / msgs->torrent->blockSize;
|
const int estimatedBlocksInPeriod = ( rateToClient * seconds * 1024 ) / msgs->torrent->blockSize;
|
||||||
|
|
||||||
msgs->minActiveRequests = 8;
|
msgs->maxActiveRequests = floor + estimatedBlocksInPeriod;
|
||||||
msgs->maxActiveRequests = msgs->minActiveRequests + estimatedBlocksInPeriod;
|
|
||||||
|
|
||||||
if( msgs->reqq > 0 )
|
if( msgs->reqq > 0 )
|
||||||
msgs->maxActiveRequests = MIN( msgs->maxActiveRequests, msgs->reqq );
|
msgs->maxActiveRequests = MIN( msgs->maxActiveRequests, msgs->reqq );
|
||||||
|
|
Loading…
Reference in New Issue