diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-20 08:21:36 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-20 08:21:36 +0000 |
| commit | 580098eb4929a3bdbf424af18da361259ef2efe5 (patch) | |
| tree | c6ff77fa55fcbdcdd0ca21ec2105db14a8c050d3 /src/IteratableChunkChecksumValidator.cc | |
| parent | 3940da75624b194cdd5036f9fe330fcecc725964 (diff) | |
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten Logger interface. Logger now writes source file name and
line number in log file.
Diffstat (limited to 'src/IteratableChunkChecksumValidator.cc')
| -rw-r--r-- | src/IteratableChunkChecksumValidator.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/IteratableChunkChecksumValidator.cc b/src/IteratableChunkChecksumValidator.cc index 7b251b56..c234cbf6 100644 --- a/src/IteratableChunkChecksumValidator.cc +++ b/src/IteratableChunkChecksumValidator.cc @@ -50,6 +50,7 @@ #include "Logger.h" #include "MessageDigest.h" #include "StringFormat.h" +#include "fmt.h" #include "DlAbortEx.h" namespace aria2 { @@ -57,15 +58,16 @@ namespace aria2 { #define BUFSIZE (256*1024) #define ALIGNMENT 512 -IteratableChunkChecksumValidator:: -IteratableChunkChecksumValidator(const SharedHandle<DownloadContext>& dctx, - const PieceStorageHandle& pieceStorage): - dctx_(dctx), - pieceStorage_(pieceStorage), - bitfield_(new BitfieldMan(dctx_->getPieceLength(), dctx_->getTotalLength())), - currentIndex_(0), - logger_(LogFactory::getInstance()), - buffer_(0) {} +IteratableChunkChecksumValidator::IteratableChunkChecksumValidator +(const SharedHandle<DownloadContext>& dctx, + const PieceStorageHandle& pieceStorage) + : dctx_(dctx), + pieceStorage_(pieceStorage), + bitfield_(new BitfieldMan(dctx_->getPieceLength(), + dctx_->getTotalLength())), + currentIndex_(0), + buffer_(0) +{} IteratableChunkChecksumValidator::~IteratableChunkChecksumValidator() { @@ -86,21 +88,19 @@ void IteratableChunkChecksumValidator::validateChunk() if(actualChecksum == dctx_->getPieceHashes()[currentIndex_]) { bitfield_->setBit(currentIndex_); } else { - if(logger_->info()) { - logger_->info(EX_INVALID_CHUNK_CHECKSUM, + A2_LOG_INFO(fmt(EX_INVALID_CHUNK_CHECKSUM, static_cast<unsigned long>(currentIndex_), util::itos(getCurrentOffset(), true).c_str(), dctx_->getPieceHashes()[currentIndex_].c_str(), - actualChecksum.c_str()); - } + actualChecksum.c_str())); bitfield_->unsetBit(currentIndex_); } } catch(RecoverableException& ex) { - if(logger_->debug()) { - logger_->debug("Caught exception while validating piece index=%lu." - " Some part of file may be missing. Continue operation.", - ex, static_cast<unsigned long>(currentIndex_)); - } + A2_LOG_DEBUG_EX(fmt("Caught exception while validating piece index=%lu." + " Some part of file may be missing." + " Continue operation.", + static_cast<unsigned long>(currentIndex_)), + ex); bitfield_->unsetBit(currentIndex_); } |
