mirror of https://github.com/aria2/aria2
2010-06-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Run whole checksum check when download file name and size are determined and download is already completed. Related to r2221. Guarded ENABLE_MESSAGE_DIGEST where necessary. * src/AbstractCommand.cc * src/RequestGroup.cc * src/message.hpull/1/head
parent
66660d10c2
commit
3a3511ee28
|
@ -1,3 +1,12 @@
|
||||||
|
2010-06-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Run whole checksum check when download file name and size are
|
||||||
|
determined and download is already completed. Related to r2221.
|
||||||
|
Guarded ENABLE_MESSAGE_DIGEST where necessary.
|
||||||
|
* src/AbstractCommand.cc
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
* src/message.h
|
||||||
|
|
||||||
2010-06-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-06-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Made log and log-level option modifiable using
|
Made log and log-level option modifiable using
|
||||||
|
|
|
@ -68,6 +68,9 @@
|
||||||
#include "NameResolver.h"
|
#include "NameResolver.h"
|
||||||
#include "ServerStatMan.h"
|
#include "ServerStatMan.h"
|
||||||
#include "FileAllocationEntry.h"
|
#include "FileAllocationEntry.h"
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
|
# include "ChecksumCheckIntegrityEntry.h"
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -719,6 +722,23 @@ std::string AbstractCommand::resolveHostname
|
||||||
// function call.
|
// function call.
|
||||||
void AbstractCommand::prepareForNextAction(Command* nextCommand)
|
void AbstractCommand::prepareForNextAction(Command* nextCommand)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
|
if(requestGroup_->downloadFinished() &&
|
||||||
|
getDownloadContext()->isChecksumVerificationNeeded()) {
|
||||||
|
if(getLogger()->info()) {
|
||||||
|
getLogger()->info(MSG_HASH_CHECK_NOT_DONE);
|
||||||
|
}
|
||||||
|
SharedHandle<CheckIntegrityEntry> entry
|
||||||
|
(new ChecksumCheckIntegrityEntry(requestGroup_));
|
||||||
|
if(entry->isValidationReady()) {
|
||||||
|
delete nextCommand;
|
||||||
|
entry->initValidator();
|
||||||
|
entry->cutTrailingGarbage();
|
||||||
|
e_->getCheckIntegrityMan()->pushEntry(entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
SharedHandle<CheckIntegrityEntry> entry
|
SharedHandle<CheckIntegrityEntry> entry
|
||||||
(new StreamCheckIntegrityEntry(requestGroup_, nextCommand));
|
(new StreamCheckIntegrityEntry(requestGroup_, nextCommand));
|
||||||
|
|
||||||
|
|
|
@ -395,11 +395,11 @@ void RequestGroup::createInitialCommand
|
||||||
downloadContext_->getBasePath().c_str());
|
downloadContext_->getBasePath().c_str());
|
||||||
} else {
|
} else {
|
||||||
loadAndOpenFile(infoFile);
|
loadAndOpenFile(infoFile);
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
if(downloadFinished() &&
|
if(downloadFinished() &&
|
||||||
downloadContext_->isChecksumVerificationNeeded()) {
|
downloadContext_->isChecksumVerificationNeeded()) {
|
||||||
if(logger_->info()) {
|
if(logger_->info()) {
|
||||||
logger_->info("File has already been downloaded but hash check has"
|
logger_->info(MSG_HASH_CHECK_NOT_DONE);
|
||||||
" not been done yet.");
|
|
||||||
}
|
}
|
||||||
SharedHandle<CheckIntegrityEntry> entry
|
SharedHandle<CheckIntegrityEntry> entry
|
||||||
(new ChecksumCheckIntegrityEntry(this));
|
(new ChecksumCheckIntegrityEntry(this));
|
||||||
|
@ -407,9 +407,10 @@ void RequestGroup::createInitialCommand
|
||||||
entry->initValidator();
|
entry->initValidator();
|
||||||
entry->cutTrailingGarbage();
|
entry->cutTrailingGarbage();
|
||||||
e->getCheckIntegrityMan()->pushEntry(entry);
|
e->getCheckIntegrityMan()->pushEntry(entry);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
SharedHandle<CheckIntegrityEntry> checkIntegrityEntry
|
SharedHandle<CheckIntegrityEntry> checkIntegrityEntry
|
||||||
(new StreamCheckIntegrityEntry(this));
|
(new StreamCheckIntegrityEntry(this));
|
||||||
processCheckIntegrityEntry(commands, checkIntegrityEntry, e);
|
processCheckIntegrityEntry(commands, checkIntegrityEntry, e);
|
||||||
|
|
|
@ -188,6 +188,8 @@
|
||||||
#define MSG_METADATA_NOT_SAVED _("Saving metadata as %s failed. Maybe file" \
|
#define MSG_METADATA_NOT_SAVED _("Saving metadata as %s failed. Maybe file" \
|
||||||
" already exists.")
|
" already exists.")
|
||||||
#define MSG_DIR_TRAVERSAL_DETECTED _("Detected directory traversal directive in %s")
|
#define MSG_DIR_TRAVERSAL_DETECTED _("Detected directory traversal directive in %s")
|
||||||
|
#define MSG_HASH_CHECK_NOT_DONE \
|
||||||
|
"File has already been downloaded but hash check has not been done yet."
|
||||||
|
|
||||||
#define EX_TIME_OUT _("Timeout.")
|
#define EX_TIME_OUT _("Timeout.")
|
||||||
#define EX_INVALID_CHUNK_SIZE _("Invalid chunk size.")
|
#define EX_INVALID_CHUNK_SIZE _("Invalid chunk size.")
|
||||||
|
|
Loading…
Reference in New Issue