summaryrefslogtreecommitdiff
path: root/src/CheckIntegrityEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-12-05 13:41:56 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-12-05 13:41:56 +0000
commitb75dbc4bbe73133b18c3b2d64f457d8d0bd50d35 (patch)
treea240b3625fea0e10b6baba673ca3eb6d1e08c796 /src/CheckIntegrityEntry.cc
parent24bdbf9aa6790f95b14449fed62d83fd196a0124 (diff)
2007-12-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Enable direct I/O support in checksum checking. * src/IteratableChunkChecksumValidator.{h, cc} * test/IteratableChunkChecksumValidatorTest.cc * src/CheckIntegrityEntry.cc * src/PieceHashCheckIntegrityEntry.cc * src/IteratableChecksumValidator.{h, cc} * src/BtCheckIntegrityEntry.cc: Added doc.
Diffstat (limited to 'src/CheckIntegrityEntry.cc')
-rw-r--r--src/CheckIntegrityEntry.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/CheckIntegrityEntry.cc b/src/CheckIntegrityEntry.cc
index 43f5a6a1..f05ba3d1 100644
--- a/src/CheckIntegrityEntry.cc
+++ b/src/CheckIntegrityEntry.cc
@@ -36,14 +36,27 @@
#include "Command.h"
#include "RequestGroup.h"
#include "IteratableValidator.h"
+#include "prefs.h"
+#include "PieceStorage.h"
+#include "DownloadContext.h"
+#include "DiskAdaptor.h"
+#include "Option.h"
CheckIntegrityEntry::CheckIntegrityEntry(RequestGroup* requestGroup,
Command* nextCommand):
RequestGroupEntry(requestGroup, nextCommand),
_validator(0)
-{}
+{
+ if(_requestGroup->getOption()->getAsBool(PREF_ENABLE_DIRECT_IO) &&
+ _requestGroup->getDownloadContext()->getFileEntries().size() == 1) {
+ _requestGroup->getPieceStorage()->getDiskAdaptor()->enableDirectIO();
+ }
+}
-CheckIntegrityEntry::~CheckIntegrityEntry() {}
+CheckIntegrityEntry::~CheckIntegrityEntry()
+{
+ // TODO DiskAdaptor::disableIO() will be called from ~FileAllocationEntry
+}
void CheckIntegrityEntry::validateChunk()
{