diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:12:52 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:20:27 +0900 |
| commit | d64089632e82a2548752c7a6baaa68365a795a74 (patch) | |
| tree | 57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/FileAllocationCommand.cc | |
| parent | c81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff) | |
| parent | a7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff) | |
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/FileAllocationCommand.cc')
| -rw-r--r-- | src/FileAllocationCommand.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index d15b3389..36ba57d1 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -52,12 +52,13 @@ namespace aria2 { -FileAllocationCommand::FileAllocationCommand -(cuid_t cuid, RequestGroup* requestGroup, DownloadEngine* e, - FileAllocationEntry* fileAllocationEntry) - : RealtimeCommand{cuid, requestGroup, e}, - fileAllocationEntry_{fileAllocationEntry} -{} +FileAllocationCommand::FileAllocationCommand( + cuid_t cuid, RequestGroup* requestGroup, DownloadEngine* e, + FileAllocationEntry* fileAllocationEntry) + : RealtimeCommand{cuid, requestGroup, e}, + fileAllocationEntry_{fileAllocationEntry} +{ +} FileAllocationCommand::~FileAllocationCommand() { @@ -66,11 +67,11 @@ FileAllocationCommand::~FileAllocationCommand() bool FileAllocationCommand::executeInternal() { - if(getRequestGroup()->isHaltRequested()) { + if (getRequestGroup()->isHaltRequested()) { return true; } fileAllocationEntry_->allocateChunk(); - if(fileAllocationEntry_->finished()) { + if (fileAllocationEntry_->finished()) { A2_LOG_DEBUG(fmt(MSG_ALLOCATION_COMPLETED, static_cast<long int>( std::chrono::duration_cast<std::chrono::seconds>( @@ -81,7 +82,8 @@ bool FileAllocationCommand::executeInternal() getDownloadEngine()->addCommand(std::move(commands)); getDownloadEngine()->setNoWait(true); return true; - } else { + } + else { getDownloadEngine()->addCommand(std::unique_ptr<Command>(this)); return false; } @@ -89,13 +91,10 @@ bool FileAllocationCommand::executeInternal() bool FileAllocationCommand::handleException(Exception& e) { - A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE, - getCuid()), - e); - A2_LOG_ERROR - (fmt(MSG_DOWNLOAD_NOT_COMPLETE, - getCuid(), - getRequestGroup()->getDownloadContext()->getBasePath().c_str())); + A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE, getCuid()), e); + A2_LOG_ERROR( + fmt(MSG_DOWNLOAD_NOT_COMPLETE, getCuid(), + getRequestGroup()->getDownloadContext()->getBasePath().c_str())); return true; } |
