Ver código fonte

2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Fixed the bug that causes aria2 not to finish download. 
BUG#1855875.
	I could reproduce this bug in following procedure:
	1. Stop the download at the very beginning(1% or 100KB 
downloaded).
	2. Restart aria2.
	3. You see the download stopped around 99%.
	* src/HttpResponseCommand.cc (handleDefaultEncoding)
	* src/StreamFileAllocationEntry.cc: Removed the timeout 
handling.
	If timeout is reached, then _nextCommand is unused and it may 
contains
	segments and they won't be canceled. Actually, timeout is not 
needed
	here because if the server dropped connection, then retry is 
made.
Tatsuhiro Tsujikawa 18 anos atrás
pai
commit
ccd4a35096
3 arquivos alterados com 16 adições e 2 exclusões
  1. 13 0
      ChangeLog
  2. 2 0
      src/HttpResponseCommand.cc
  3. 1 2
      src/StreamFileAllocationEntry.cc

+ 13 - 0
ChangeLog

@@ -1,3 +1,16 @@
+2007-12-22  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Fixed the bug that causes aria2 not to finish download. BUG#1855875.
+	I could reproduce this bug in following procedure:
+	1. Stop the download at the very beginning(1% or 100KB downloaded).
+	2. Restart aria2.
+	3. You see the download stopped around 99%.
+	* src/HttpResponseCommand.cc (handleDefaultEncoding)
+	* src/StreamFileAllocationEntry.cc: Removed the timeout handling.
+	If timeout is reached, then _nextCommand is unused and it may contains
+	segments and they won't be canceled. Actually, timeout is not needed
+	here because if the server dropped connection, then retry is made.
+
 2007-12-22  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Added uTorrent compatible Peer Exchange.

+ 2 - 0
src/HttpResponseCommand.cc

@@ -139,6 +139,8 @@ bool HttpResponseCommand::handleDefaultEncoding(const HttpResponseHandle& httpRe
     SegmentHandle segment = _requestGroup->getSegmentMan()->getSegment(cuid, 0);
     if(!segment.isNull() && segment->getPositionToWrite() == 0) {
       command = createHttpDownloadCommand(httpResponse);
+    } else {
+      _requestGroup->getSegmentMan()->cancelSegment(cuid);
     }
     prepareForNextAction(command);
     e->noWait = true;

+ 1 - 2
src/StreamFileAllocationEntry.cc

@@ -54,8 +54,7 @@ StreamFileAllocationEntry::~StreamFileAllocationEntry() {}
 Commands StreamFileAllocationEntry::prepareForNextAction(DownloadEngine* e)
 {
   Commands commands;
-  if(_timer.difference() <= e->option->getAsInt(PREF_DIRECT_DOWNLOAD_TIMEOUT) &&
-     _nextCommand) {
+  if(_nextCommand) {
     commands.push_back(popNextCommand());
     // try remaining uris
     Commands streamCommands = _requestGroup->createNextCommandWithAdj(e, -1);