diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-08 10:47:00 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-08 10:47:00 +0000 |
| commit | 2ad5df249ea835e14981ca84643b1bd23d037253 (patch) | |
| tree | 45d77f04bc7c4509f2b288edd262c8dc5c7acf4b /src/MultiFileAllocationIterator.cc | |
| parent | 23294a746e6ef71a0801eb30c295c71984556f7e (diff) | |
2008-06-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Limited the number files opened in each BitTorrent download. The
default
value is 100. The option to change this value will be added.
* src/MultiDiskAdaptor.cc
* src/MultiDiskAdaptor.h
* src/MultiFileAllocationIterator.cc
Diffstat (limited to 'src/MultiFileAllocationIterator.cc')
| -rw-r--r-- | src/MultiFileAllocationIterator.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/MultiFileAllocationIterator.cc b/src/MultiFileAllocationIterator.cc index 680a7bc0..349d174f 100644 --- a/src/MultiFileAllocationIterator.cc +++ b/src/MultiFileAllocationIterator.cc @@ -59,8 +59,12 @@ void MultiFileAllocationIterator::allocateChunk() DiskWriterEntryHandle entry = _entries.front(); _entries.pop_front(); FileEntryHandle fileEntry = entry->getFileEntry(); + // Open file before calling DiskWriterEntry::size() + _diskAdaptor->openIfNot(entry, &DiskWriterEntry::openFile, + _diskAdaptor->getTopDirPath()); + entry->enableDirectIO(); if(entry->size() < fileEntry->getLength()) { - entry->getDiskWriter()->enableDirectIO(); + // Calling private function of MultiDiskAdaptor. _fileAllocationIterator.reset (new SingleFileAllocationIterator(entry->getDiskWriter().get(), entry->size(), |
