mirror of https://github.com/aria2/aria2
parent
947967fc63
commit
d316a00ade
|
@ -263,7 +263,7 @@ bool AbstractCommand::execute() {
|
|||
DL_ABORT_EX2(fmt("URI=%s", req_->getCurrentUri().c_str()),
|
||||
err));
|
||||
fileEntry_->addURIResult(req_->getUri(), err.getCode());
|
||||
requestGroup_->setLastUriResult(req_->getUri(), err.getCode());
|
||||
requestGroup_->setLastErrorCode(err.getCode());
|
||||
if(err.getCode() == error_code::CANNOT_RESUME) {
|
||||
requestGroup_->increaseResumeFailureCount();
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ bool AbstractCommand::execute() {
|
|||
req_->getUri().c_str()),
|
||||
err);
|
||||
fileEntry_->addURIResult(req_->getUri(), err.getCode());
|
||||
requestGroup_->setLastUriResult(req_->getUri(), err.getCode());
|
||||
requestGroup_->setLastErrorCode(err.getCode());
|
||||
if(err.getCode() == error_code::CANNOT_RESUME) {
|
||||
requestGroup_->increaseResumeFailureCount();
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ bool AbstractCommand::execute() {
|
|||
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, err);
|
||||
if(req_) {
|
||||
fileEntry_->addURIResult(req_->getUri(), err.getCode());
|
||||
requestGroup_->setLastUriResult(req_->getUri(), err.getCode());
|
||||
requestGroup_->setLastErrorCode(err.getCode());
|
||||
}
|
||||
requestGroup_->setHaltRequested(true);
|
||||
return true;
|
||||
|
|
|
@ -146,6 +146,7 @@ RequestGroup::RequestGroup(const SharedHandle<Option>& option)
|
|||
inMemoryDownload_(false),
|
||||
maxDownloadSpeedLimit_(option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT)),
|
||||
maxUploadSpeedLimit_(option->getAsInt(PREF_MAX_UPLOAD_LIMIT)),
|
||||
lastErrorCode_(error_code::UNDEFINED),
|
||||
belongsToGID_(0),
|
||||
requestGroupMan_(0),
|
||||
resumeFailureCount_(0)
|
||||
|
@ -195,7 +196,7 @@ error_code::Value RequestGroup::downloadResult() const
|
|||
if(downloadFinished() && !downloadContext_->isChecksumVerificationNeeded())
|
||||
return error_code::FINISHED;
|
||||
else {
|
||||
if(!lastUriResult_) {
|
||||
if(lastErrorCode_ == error_code::UNDEFINED) {
|
||||
if(haltReason_ == RequestGroup::USER_REQUEST ||
|
||||
haltReason_ == RequestGroup::SHUTDOWN_SIGNAL) {
|
||||
return error_code::IN_PROGRESS;
|
||||
|
@ -203,7 +204,7 @@ error_code::Value RequestGroup::downloadResult() const
|
|||
return error_code::UNKNOWN_ERROR;
|
||||
}
|
||||
} else {
|
||||
return lastUriResult_->getResult();
|
||||
return lastErrorCode_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1278,12 +1279,6 @@ bool RequestGroup::doesUploadSpeedExceed()
|
|||
maxUploadSpeedLimit_ < calculateStat().getUploadSpeed();
|
||||
}
|
||||
|
||||
void RequestGroup::setLastUriResult
|
||||
(const std::string uri, error_code::Value result)
|
||||
{
|
||||
lastUriResult_.reset(new URIResult(uri, result));
|
||||
}
|
||||
|
||||
void RequestGroup::saveControlFile() const
|
||||
{
|
||||
if(saveControlFile_) {
|
||||
|
|
|
@ -155,7 +155,7 @@ private:
|
|||
|
||||
unsigned int maxUploadSpeedLimit_;
|
||||
|
||||
SharedHandle<URIResult> lastUriResult_;
|
||||
error_code::Value lastErrorCode_;
|
||||
|
||||
// If this download generates another downloads when completed(for
|
||||
// example, downloads generated by PostDownloadHandler), this field
|
||||
|
@ -481,7 +481,10 @@ public:
|
|||
maxUploadSpeedLimit_ = speed;
|
||||
}
|
||||
|
||||
void setLastUriResult(std::string uri, error_code::Value result);
|
||||
void setLastErrorCode(error_code::Value code)
|
||||
{
|
||||
lastErrorCode_ = code;
|
||||
}
|
||||
|
||||
void saveControlFile() const;
|
||||
|
||||
|
|
|
@ -73,8 +73,7 @@ void RequestGroupTest::testCreateDownloadResult()
|
|||
CPPUNIT_ASSERT_EQUAL(error_code::IN_PROGRESS, result->result);
|
||||
}
|
||||
{
|
||||
group.setLastUriResult
|
||||
("http://second/file",error_code::RESOURCE_NOT_FOUND);
|
||||
group.setLastErrorCode(error_code::RESOURCE_NOT_FOUND);
|
||||
|
||||
SharedHandle<DownloadResult> result = group.createDownloadResult();
|
||||
|
||||
|
|
Loading…
Reference in New Issue