Browse Source

2008-07-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Fixed the bug that causes infinite loop when the number of 
pieces are
	fewer than allowed fast set size which is 10 by default.
	* src/DefaultBtContext.cc
Tatsuhiro Tsujikawa 17 years ago
parent
commit
8929168380
2 changed files with 9 additions and 0 deletions
  1. 6 0
      ChangeLog
  2. 3 0
      src/DefaultBtContext.cc

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-07-12  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Fixed the bug that causes infinite loop when the number of pieces are
+	fewer than allowed fast set size which is 10 by default.
+	* src/DefaultBtContext.cc
+
 2008-07-08  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Updated the descriptions for -j, -s. Added --bt-seed.

+ 3 - 0
src/DefaultBtContext.cc

@@ -422,6 +422,9 @@ void DefaultBtContext::computeFastSet
   if(!PeerMessageUtil::createcompact(compact, ipaddr, 0)) {
     return;
   }
+  if(numPieces < fastSetSize) {
+    fastSetSize = numPieces;
+  }
   unsigned char tx[24];
   memcpy(tx, compact, 4);
   if((tx[0] & 0x80) == 0 || (tx[0] & 0x40) == 0) {