mirror of https://github.com/aria2/aria2
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Add formerly fastest PeerStat's sessionDownloadLength to new fastest PeerStat and use _fastestPeerStats to calcuate downloaded bytes in a session. * src/PeerStat.cc * src/SegmentMan.ccpull/1/head
parent
2a2c8c5da0
commit
3a655a5d1a
|
@ -1,3 +1,11 @@
|
|||
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Add formerly fastest PeerStat's sessionDownloadLength to new
|
||||
fastest PeerStat and use _fastestPeerStats to calcuate downloaded
|
||||
bytes in a session.
|
||||
* src/PeerStat.cc
|
||||
* src/SegmentMan.cc
|
||||
|
||||
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
If pipelining is enabled, we can always pool socket.
|
||||
|
|
|
@ -188,6 +188,11 @@ public:
|
|||
{
|
||||
return _sessionUploadLength;
|
||||
}
|
||||
|
||||
void addSessionDownloadLength(uint64_t length)
|
||||
{
|
||||
_sessionDownloadLength += length;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<PeerStat> PeerStatHandle;
|
||||
|
|
|
@ -314,6 +314,7 @@ void SegmentMan::updateFastestPeerStat(const SharedHandle<PeerStat>& peerStat)
|
|||
if(i == _fastestPeerStats.end()) {
|
||||
_fastestPeerStats.push_back(peerStat);
|
||||
} else if((*i)->getAvgDownloadSpeed() < peerStat->getAvgDownloadSpeed()) {
|
||||
peerStat->addSessionDownloadLength((*i)->getSessionDownloadLength());
|
||||
*i = peerStat;
|
||||
}
|
||||
}
|
||||
|
@ -362,9 +363,8 @@ public:
|
|||
|
||||
uint64_t SegmentMan::calculateSessionDownloadLength() const
|
||||
{
|
||||
return std::accumulate(peerStats.begin(), peerStats.end(), 0LL,
|
||||
PeerStatDownloadLengthOperator());
|
||||
|
||||
return std::accumulate(_fastestPeerStats.begin(), _fastestPeerStats.end(),
|
||||
0LL, PeerStatDownloadLengthOperator());
|
||||
}
|
||||
|
||||
size_t SegmentMan::countFreePieceFrom(size_t index) const
|
||||
|
|
Loading…
Reference in New Issue