diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-29 21:06:39 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-29 21:06:39 +0900 |
| commit | 6bc215fcec22d8bdf760c78cc25cb8798266c8a5 (patch) | |
| tree | c50e95dd9cd92468b50d82f766ae82acc798da0e | |
| parent | 378ba26ed31d4564594150a863511b625c3366de (diff) | |
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().
| -rw-r--r-- | src/RequestGroupMan.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/RequestGroupMan.cc b/src/RequestGroupMan.cc index ff4257c1..a99e9a2b 100644 --- a/src/RequestGroupMan.cc +++ b/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()); |
