Browse Source

2008-02-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Request peers thought DHT only when download hasn't finished.
	* src/DHTGetPeersCommand.cc
Tatsuhiro Tsujikawa 17 years ago
parent
commit
f1d786469c
2 changed files with 7 additions and 1 deletions
  1. 5 0
      ChangeLog
  2. 2 1
      src/DHTGetPeersCommand.cc

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2008-02-09  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Request peers thought DHT only when download hasn't finished.
+	* src/DHTGetPeersCommand.cc
+
 2008-02-09  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Force refresh bucket when startup if certain time has passed(currently 15 minutes).

+ 2 - 1
src/DHTGetPeersCommand.cc

@@ -44,6 +44,7 @@
 #include "BtContext.h"
 #include "BtRuntime.h"
 #include "PeerStorage.h"
+#include "PieceStorage.h"
 #include "Peer.h"
 #include "Logger.h"
 
@@ -71,7 +72,7 @@ bool DHTGetPeersCommand::execute()
   if(btRuntime->isHalt()) {
     return true;
   }
-  if(_task.isNull() &&
+  if(!pieceStorage->downloadFinished() && _task.isNull() &&
      (_numRetry > 0 && _lastGetPeerTime.elapsed(RETRY_INTERVAL) ||
       _lastGetPeerTime.elapsed(GET_PEER_INTERVAL))) {
     logger->debug("Issuing PeerLookup for infoHash=%s",