浏览代码

* AbstractCommand.cc:
* DownloadCommand.{h, cc}: Aborted downloading commands now
properly
unregister its cuid from SegmentMan.
* DownloadEngine.cc: .aria2 file was written when a downloading
failed with errors.

Tatsuhiro Tsujikawa 19 年之前
父节点
当前提交
bc1cf6ed2d
共有 8 个文件被更改,包括 32 次插入24 次删除
  1. 8 0
      ChangeLog
  2. 10 10
      configure
  3. 1 1
      configure.in
  4. 10 5
      src/AbstractCommand.cc
  5. 1 1
      src/AbstractCommand.h
  6. 0 5
      src/DownloadCommand.cc
  7. 0 1
      src/DownloadCommand.h
  8. 2 1
      src/DownloadEngine.cc

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2006-03-01  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	* AbstractCommand.cc:
+	* DownloadCommand.{h, cc}: Aborted downloading commands now properly
+	unregister its cuid from SegmentMan.	
+	* DownloadEngine.cc: .aria2 file was written when a downloading
+	failed with errors.
+	
 2006-02-28  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	* Util.{h,cc}: added startsWith().

+ 10 - 10
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for aria2c 0.2.0-dev.
+# Generated by GNU Autoconf 2.59 for aria2c 0.2.1-dev.
 #
 # Report bugs to <tujikawa@rednoah.com>.
 #
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='aria2c'
 PACKAGE_TARNAME='aria2c'
-PACKAGE_VERSION='0.2.0-dev'
-PACKAGE_STRING='aria2c 0.2.0-dev'
+PACKAGE_VERSION='0.2.1-dev'
+PACKAGE_STRING='aria2c 0.2.1-dev'
 PACKAGE_BUGREPORT='tujikawa@rednoah.com'
 
 ac_unique_file="src/Socket.h"
@@ -788,7 +788,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures aria2c 0.2.0-dev to adapt to many kinds of systems.
+\`configure' configures aria2c 0.2.1-dev to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -850,7 +850,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of aria2c 0.2.0-dev:";;
+     short | recursive ) echo "Configuration of aria2c 0.2.1-dev:";;
    esac
   cat <<\_ACEOF
 
@@ -977,7 +977,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-aria2c configure 0.2.0-dev
+aria2c configure 0.2.1-dev
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -991,7 +991,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by aria2c $as_me 0.2.0-dev, which was
+It was created by aria2c $as_me 0.2.1-dev, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1634,7 +1634,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='aria2c'
- VERSION='0.2.0-dev'
+ VERSION='0.2.1-dev'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5808,7 +5808,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by aria2c $as_me 0.2.0-dev, which was
+This file was extended by aria2c $as_me 0.2.1-dev, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5871,7 +5871,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-aria2c config.status 0.2.0-dev
+aria2c config.status 0.2.1-dev
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 

+ 1 - 1
configure.in

@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 #
 AC_PREREQ(2.59)
-AC_INIT(aria2c, 0.2.0-dev, tujikawa@rednoah.com)
+AC_INIT(aria2c, 0.2.1-dev, tujikawa@rednoah.com)
 AM_INIT_AUTOMAKE()
 AM_PATH_CPPUNIT(1.10.2)
 AC_CONFIG_SRCDIR([src/Socket.h])

+ 10 - 5
src/AbstractCommand.cc

@@ -99,11 +99,14 @@ bool AbstractCommand::execute() {
     return true;
   } catch(DlRetryEx* err) {
     e->logger->error(MSG_RESTARTING_DOWNLOAD, err, cuid);
-    delete(err);
-    //req->resetUrl();
     req->addTryCount();
-    if(e->option->getAsInt(PREF_MAX_TRIES) != 0 &&
-       req->getTryCount() >= e->option->getAsInt(PREF_MAX_TRIES)) {
+    bool isAbort = e->option->getAsInt(PREF_MAX_TRIES) != 0 &&
+      req->getTryCount() >= e->option->getAsInt(PREF_MAX_TRIES);
+    if(isAbort) {
+      onAbort(err);
+    }
+    delete(err);
+    if(isAbort) {
       e->logger->error(MSG_MAX_TRY, cuid, req->getTryCount());
       return true;
     } else {
@@ -123,7 +126,9 @@ bool AbstractCommand::prepareForRetry(int wait) {
   return true;
 }
 
-void AbstractCommand::onAbort(Exception* e) {
+void AbstractCommand::onAbort(Exception* ex) {
+  e->logger->debug(MSG_UNREGISTER_CUID, cuid);
+  e->segmentMan->unregisterId(cuid);
 }
 
 void AbstractCommand::setReadCheckSocket(Socket* socket) {

+ 1 - 1
src/AbstractCommand.h

@@ -39,7 +39,7 @@ protected:
   Socket* socket;
 
   virtual bool prepareForRetry(int wait);
-  virtual void onAbort(Exception* e);
+  virtual void onAbort(Exception* ex);
   virtual bool executeInternal(Segment segment) = 0;
 
   void setReadCheckSocket(Socket* socket);

+ 0 - 5
src/DownloadCommand.cc

@@ -99,8 +99,3 @@ bool DownloadCommand::prepareForNextSegment() {
     return true;
   }
 }
-
-void DownloadCommand::onAbort(Exception* ex) {
-  e->logger->debug(MSG_UNREGISTER_CUID, cuid);
-  e->segmentMan->unregisterId(cuid);
-}

+ 0 - 1
src/DownloadCommand.h

@@ -38,7 +38,6 @@ protected:
 
   bool prepareForRetry(int wait);
   bool prepareForNextSegment();
-  void onAbort(Exception* ex);
 public:
   DownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
   virtual ~DownloadCommand();

+ 2 - 1
src/DownloadEngine.cc

@@ -78,11 +78,12 @@ void DownloadEngine::run() {
     }
 
   }
-  segmentMan->removeIfFinished();
   diskWriter->closeFile();
   if(segmentMan->finished()) {
+    segmentMan->remove();
     cout << "\nThe download was complete. <" << segmentMan->getFilePath() << ">" << endl;
   } else {
+    segmentMan->save();
     cout << "\nThe download was not complete because of errors. Check the log." << endl;
   }
 }