Browse Source

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
Tatsuhiro Tsujikawa 16 years ago
parent
commit
de23f72818
2 changed files with 10 additions and 0 deletions
  1. 6 0
      ChangeLog
  2. 4 0
      src/SegmentMan.cc

+ 6 - 0
ChangeLog

@@ -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>
 
 	Updated doc.

+ 4 - 0
src/SegmentMan.cc

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