فهرست منبع

Add groupToAdd to requestGroups_ even if exception is thrown in
createInitialCommand().

This makes groupToAdd be processed by removeStoppedGroup() and
--on-download-error hook is properly triggered. Now
--on-download-start is also triggered for groupToAdd even if exception
is thrown in createInitialCommand().

Tatsuhiro Tsujikawa 15 سال پیش
والد
کامیت
6bc215fcec
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      src/RequestGroupMan.cc

+ 6 - 4
src/RequestGroupMan.cc

@@ -516,8 +516,6 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
       ++count;
       e->addCommand(commands);
       commands.clear();
-      util::executeHookByOptName
-        (groupToAdd, e->getOption(), PREF_ON_DOWNLOAD_START);
     } catch(RecoverableException& ex) {
       A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex);
       A2_LOG_DEBUG("Deleting temporal commands.");
@@ -525,9 +523,13 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
       commands.clear();
       A2_LOG_DEBUG("Commands deleted");
       groupToAdd->setLastErrorCode(ex.getErrorCode());
-      groupToAdd->releaseRuntimeResource(e);
-      addDownloadResult(groupToAdd->createDownloadResult());
+      // We add groupToAdd to e in order to it is processed in
+      // removeStoppedGroup().
+      requestGroups_.push_back(groupToAdd);
+      requestQueueCheck();
     }
+    util::executeHookByOptName
+      (groupToAdd, e->getOption(), PREF_ON_DOWNLOAD_START);
   }
   if(!temp.empty()) {
     reservedGroups_.insert(reservedGroups_.begin(), temp.begin(), temp.end());