diff --git a/ChangeLog b/ChangeLog index 2d812293..568e1559 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-03-01 Tatsuhiro Tsujikawa + + * 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 * Util.{h,cc}: added startsWith(). diff --git a/configure b/configure index a2322203..945bcded 100755 --- a/configure +++ b/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 . # @@ -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'`\\" diff --git a/configure.in b/configure.in index 5ca06d30..6ca8f8dc 100644 --- a/configure.in +++ b/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]) diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 6fe1d2ae..7caa1fa7 100644 --- a/src/AbstractCommand.cc +++ b/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) { diff --git a/src/AbstractCommand.h b/src/AbstractCommand.h index 0a4075e7..e6328a71 100644 --- a/src/AbstractCommand.h +++ b/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); diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc index b771cbe5..5b582c98 100644 --- a/src/DownloadCommand.cc +++ b/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); -} diff --git a/src/DownloadCommand.h b/src/DownloadCommand.h index 4e26eb7c..79aaf2e5 100644 --- a/src/DownloadCommand.h +++ b/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(); diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index ff38fa17..965699d0 100644 --- a/src/DownloadEngine.cc +++ b/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; } }