mirror of https://github.com/aria2/aria2
2008-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Add a file descriptor which connected to fast peer(latency<1500) to select(). This change reduced CPU load. * src/PeerInteractionCommand.cc * src/DefaultBtInteractive.{h, cc} * src/BtInteractive.hpull/1/head
parent
c766d945ef
commit
a1458a1642
|
@ -1,3 +1,11 @@
|
|||
2008-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Add a file descriptor which connected to fast peer(latency<1500) to
|
||||
select(). This change reduced CPU load.
|
||||
* src/PeerInteractionCommand.cc
|
||||
* src/DefaultBtInteractive.{h, cc}
|
||||
* src/BtInteractive.h
|
||||
|
||||
2008-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed the previous insufficient fix for possible busy loop.
|
||||
|
|
|
@ -65,6 +65,8 @@ public:
|
|||
virtual bool isSendingMessageInProgress() = 0;
|
||||
|
||||
virtual size_t countReceivedMessageInIteration() const = 0;
|
||||
|
||||
virtual size_t countOutstandingRequest() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtInteractive> BtInteractiveHandle;
|
||||
|
|
|
@ -453,6 +453,11 @@ size_t DefaultBtInteractive::countReceivedMessageInIteration() const
|
|||
return _numReceivedMessage;
|
||||
}
|
||||
|
||||
size_t DefaultBtInteractive::countOutstandingRequest()
|
||||
{
|
||||
return dispatcher->countOutstandingRequest();
|
||||
}
|
||||
|
||||
void DefaultBtInteractive::setPeer(const SharedHandle<Peer>& peer)
|
||||
{
|
||||
this->peer = peer;
|
||||
|
|
|
@ -156,6 +156,8 @@ public:
|
|||
|
||||
virtual size_t countReceivedMessageInIteration() const;
|
||||
|
||||
virtual size_t countOutstandingRequest();
|
||||
|
||||
void setCuid(int32_t cuid) {
|
||||
this->cuid = cuid;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ bool PeerInteractionCommand::executeInternal() {
|
|||
if(btInteractive->countReceivedMessageInIteration() > 0) {
|
||||
updateKeepAlive();
|
||||
}
|
||||
if(peer->amInterested() && !peer->peerChoking() ||
|
||||
if(peer->amInterested() && !peer->peerChoking() && peer->getLatency() < 1500 ||
|
||||
peer->peerInterested() && !peer->amChoking()) {
|
||||
if(maxDownloadSpeedLimit > 0) {
|
||||
TransferStat stat = peerStorage->calculateStat();
|
||||
|
|
Loading…
Reference in New Issue