2009-07-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Fixed the bug that session download length is not updated when
	PeerStat is not fastest one.
	* src/SegmentMan.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-07-15 12:36:58 +00:00
parent 20930f7a7e
commit de23f72818
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-07-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that session download length is not updated when
PeerStat is not fastest one.
* src/SegmentMan.cc
2009-07-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2009-07-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Updated doc. Updated doc.

View File

@ -314,8 +314,12 @@ void SegmentMan::updateFastestPeerStat(const SharedHandle<PeerStat>& peerStat)
if(i == _fastestPeerStats.end()) { if(i == _fastestPeerStats.end()) {
_fastestPeerStats.push_back(peerStat); _fastestPeerStats.push_back(peerStat);
} else if((*i)->getAvgDownloadSpeed() < peerStat->getAvgDownloadSpeed()) { } else if((*i)->getAvgDownloadSpeed() < peerStat->getAvgDownloadSpeed()) {
// *i's SessionDownloadLength must be added to peerStat
peerStat->addSessionDownloadLength((*i)->getSessionDownloadLength()); peerStat->addSessionDownloadLength((*i)->getSessionDownloadLength());
*i = peerStat; *i = peerStat;
} else {
// peerStat's SessionDownloadLength must be added to *i
(*i)->addSessionDownloadLength(peerStat->getSessionDownloadLength());
} }
} }