diff options
Diffstat (limited to 'src/AbstractCommand.cc')
| -rw-r--r-- | src/AbstractCommand.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 0de96354..a622959a 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -77,6 +77,7 @@ bool AbstractCommand::execute() { delete(err); req->resetUrl(); e->segmentMan->errors++; + tryReserved(); return true; } catch(DlRetryEx* err) { logger->error(MSG_RESTARTING_DOWNLOAD, err, cuid); @@ -90,6 +91,7 @@ bool AbstractCommand::execute() { if(isAbort) { logger->error(MSG_MAX_TRY, cuid, req->getTryCount()); e->segmentMan->errors++; + tryReserved(); return true; } else { return prepareForRetry(e->option->getAsInt(PREF_RETRY_WAIT)); @@ -97,6 +99,15 @@ bool AbstractCommand::execute() { } } +void AbstractCommand::tryReserved() { + if(!e->segmentMan->reserved.empty()) { + Request* req = e->segmentMan->reserved.front(); + e->segmentMan->reserved.pop_front(); + Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, e); + e->commands.push_back(command); + } +} + bool AbstractCommand::prepareForRetry(int wait) { Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, e); if(wait == 0) { |
