Prechádzať zdrojové kódy

2007-11-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Fixed: compilation fails without c-ares/ares
	* src/DownloadEngine.cc (addCommand): Moved outside #ifdef

	Generate http/ftp commands only when download is incomplete.
	* src/BtFileAllocationEntry.cc (prepareForNextAction)
Tatsuhiro Tsujikawa 18 rokov pred
rodič
commit
355a91cdec
3 zmenil súbory, kde vykonal 17 pridanie a 9 odobranie
  1. 8 0
      ChangeLog
  2. 4 3
      src/BtFileAllocationEntry.cc
  3. 5 6
      src/DownloadEngine.cc

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2007-11-24  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Fixed: compilation fails without c-ares/ares
+	* src/DownloadEngine.cc (addCommand): Moved outside #ifdef
+
+	Generate http/ftp commands only when download is incomplete.
+	* src/BtFileAllocationEntry.cc (prepareForNextAction)
+
 2007-11-23  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Corrected typo. Examples are removed since they are available in man

+ 4 - 3
src/BtFileAllocationEntry.cc

@@ -46,8 +46,9 @@ BtFileAllocationEntry::~BtFileAllocationEntry() {}
 Commands BtFileAllocationEntry::prepareForNextAction(DownloadEngine* e)
 {
   Commands commands = BtSetup().setup(_requestGroup, e, e->option);
-  // TODO don't integerate http/ftp when multi-file torrent
-  Commands streamCommands = _requestGroup->createNextCommandWithAdj(e, 0);
-  copy(streamCommands.begin(), streamCommands.end(), back_inserter(commands));
+  if(!_requestGroup->downloadFinished()) {
+    Commands streamCommands = _requestGroup->createNextCommandWithAdj(e, 0);
+    copy(streamCommands.begin(), streamCommands.end(), back_inserter(commands));
+  }
   return commands;
 }

+ 5 - 6
src/DownloadEngine.cc

@@ -292,6 +292,11 @@ void DownloadEngine::setStatCalc(const StatCalcHandle& statCalc)
   _statCalc = statCalc;
 }
 
+void DownloadEngine::addCommand(const Commands& commands)
+{
+  this->commands.insert(this->commands.end(), commands.begin(), commands.end());
+}
+
 #ifdef ENABLE_ASYNC_DNS
 bool DownloadEngine::addNameResolverCheck(const NameResolverHandle& resolver,
 					  Command* command) {
@@ -322,10 +327,4 @@ bool DownloadEngine::deleteNameResolverCheck(const NameResolverHandle& resolver,
     return true;
   }
 }
-
-void DownloadEngine::addCommand(const Commands& commands)
-{
-  this->commands.insert(this->commands.end(), commands.begin(), commands.end());
-}
-
 #endif // ENABLE_ASYNC_DNS