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
This commit is contained in:
Tatsuhiro Tsujikawa
2008-06-08 10:47:00 +00:00
parent 23294a746e
commit 2ad5df249e
4 changed files with 130 additions and 22 deletions

View File

@@ -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(),