diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-05-16 22:01:49 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-05-16 22:01:49 +0900 |
| commit | 653f04ef5cfc71456f4da6f37f6616966ce287af (patch) | |
| tree | 79b48ac4a578de71522fe4ff75c90a8d9d2dbc01 /src/AbstractCommand.cc | |
| parent | c9fe4c64f52ded139a2e9bfdd9e6fd714f863fc2 (diff) | |
Add CreateRequestCommand with STATUS_INACTIVE instead of SleepCommand
+ DownloadFailureException.
Throwing DownloadFailureException may stop download unexpectedly when
--reuse-uri is false. Using CreateRequestCommand with STATUS_INACTIVE,
they can be executed next iteration with
DownloadEngine::setRefreshInterval(0).
Diffstat (limited to 'src/AbstractCommand.cc')
| -rw-r--r-- | src/AbstractCommand.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 7d096e19..b7f246b5 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -211,10 +211,10 @@ bool AbstractCommand::execute() { // no URIs available, so don't retry. if(getSegmentMan()->allSegmentsIgnored()) { A2_LOG_DEBUG("All segments are ignored."); - // In this case, the error might be already set in - // RequestGroup, so use it here. - throw DOWNLOAD_FAILURE_EXCEPTION2 - ("No URI available.", requestGroup_->getLastErrorCode()); + // This will execute other idle Commands and let them + // finish quickly. + e_->setRefreshInterval(0); + return true; } else { return prepareForRetry(1); } @@ -383,9 +383,10 @@ bool AbstractCommand::prepareForRetry(time_t wait) { e_->setNoWait(true); e_->addCommand(command); } else { - SleepCommand* scom = new SleepCommand(getCuid(), e_, requestGroup_, - command, wait); - e_->addCommand(scom); + // We don't use wait so that Command can be executed by + // DownloadEngine::setRefreshInterval(0). + command->setStatus(Command::STATUS_INACTIVE); + e_->addCommand(command); } return true; } |
