aria2/test/MultiDiskAdaptorTest.cc

458 lines
16 KiB
C++
Raw Normal View History

2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
#include "MultiDiskAdaptor.h"
#include <string>
#include <cerrno>
#include <cstring>
#include <cppunit/extensions/HelperMacros.h>
#include "FileEntry.h"
#include "Exception.h"
#include "a2io.h"
#include "array_fun.h"
#include "TestUtil.h"
#include "DiskWriter.h"
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
namespace aria2 {
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
class MultiDiskAdaptorTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(MultiDiskAdaptorTest);
CPPUNIT_TEST(testWriteData);
CPPUNIT_TEST(testReadData);
CPPUNIT_TEST(testCutTrailingGarbage);
CPPUNIT_TEST(testSize);
CPPUNIT_TEST(testUtime);
CPPUNIT_TEST(testResetDiskWriterEntries);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
CPPUNIT_TEST_SUITE_END();
private:
SharedHandle<MultiDiskAdaptor> adaptor;
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
public:
void setUp() {
adaptor.reset(new MultiDiskAdaptor());
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->setPieceLength(2);
}
void testWriteData();
void testReadData();
void testCutTrailingGarbage();
void testSize();
void testUtime();
void testResetDiskWriterEntries();
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
};
CPPUNIT_TEST_SUITE_REGISTRATION( MultiDiskAdaptorTest );
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > createEntries() {
SharedHandle<FileEntry> array[] = {
SharedHandle<FileEntry>(new FileEntry("file0.txt", 0, 0)),
SharedHandle<FileEntry>(new FileEntry("file1.txt", 15, 0)),
SharedHandle<FileEntry>(new FileEntry("file2.txt", 7, 15)),
SharedHandle<FileEntry>(new FileEntry("file3.txt", 0, 22)),
SharedHandle<FileEntry>(new FileEntry("file4.txt", 2, 22)),
SharedHandle<FileEntry>(new FileEntry("file5.txt", 0, 24)),
SharedHandle<FileEntry>(new FileEntry("file6.txt", 3, 24)),
SharedHandle<FileEntry>(new FileEntry("file7.txt", 0, 27)),
SharedHandle<FileEntry>(new FileEntry("file8.txt", 2, 27)),
};
// 1 1 2 2 3
// 0....5....0....5....0....5....0
// ++--++--++--++--++--++--++--++--
// | file0
// *************** file1
// ******* file2
// | file3
// ** flie4
// | file5
// *** file6
// |file7
// ** file8
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > entries(&array[0],
&array[arrayLength(array)]);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
for(std::vector<SharedHandle<FileEntry> >::const_iterator i = entries.begin();
i != entries.end(); ++i) {
File((*i)->getPath()).remove();
}
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
return entries;
}
void MultiDiskAdaptorTest::testResetDiskWriterEntries()
{
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
fileEntries[0]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
// Because entries[1] spans entries[0]
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
fileEntries[0]->setRequested(false);
fileEntries[1]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(entries[0]->getDiskWriter().isNull());
// Because entries[2] spans entries[1]
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[1]->needsFileAllocation());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
fileEntries[3]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
// Because entries[4] spans entries[3]
CPPUNIT_ASSERT(!entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[3]->needsFileAllocation());
CPPUNIT_ASSERT(!entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
fileEntries[4]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[3]->getDiskWriter().isNull());
// entries[3] is 0 length. No overrap with entries[4]
CPPUNIT_ASSERT(entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
fileEntries[3]->setRequested(false);
fileEntries[4]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
for(size_t i = 5; i < 9; ++i) {
fileEntries[i]->setRequested(false);
}
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
// In openFile(), resetDiskWriterEntries() are called.
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
for(size_t i = 1; i < 9; ++i) {
fileEntries[i]->setRequested(false);
}
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
for(size_t i = 2; i < 9; ++i) {
fileEntries[i]->setRequested(false);
}
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(!entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[1]->getDiskWriter().isNull());
// entries[1] spans entries[2]
CPPUNIT_ASSERT(!entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[2]->needsFileAllocation());
CPPUNIT_ASSERT(entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[4]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[5]->getDiskWriter().isNull());
adaptor->closeFile();
}
{
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries = createEntries();
for(size_t i = 0; i < 6; ++i) {
fileEntries[i]->setRequested(false);
}
fileEntries[8]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
adaptor->openFile();
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<DiskWriterEntry> > entries =
adaptor->getDiskWriterEntries();
CPPUNIT_ASSERT(entries[0]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[1]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[2]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[3]->getDiskWriter().isNull());
CPPUNIT_ASSERT(entries[4]->getDiskWriter().isNull());
// entries[6] spans entries[5] in the current implementation.
CPPUNIT_ASSERT(!entries[5]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[6]->getDiskWriter().isNull());
CPPUNIT_ASSERT(!entries[7]->getDiskWriter().isNull());
// entries[6] spans entries[8]
CPPUNIT_ASSERT(!entries[8]->getDiskWriter().isNull());
adaptor->closeFile();
}
}
void readFile(const std::string& filename, char* buf, int bufLength) {
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
FILE* f = fopen(filename.c_str(), "r");
if(f == NULL) {
CPPUNIT_FAIL(strerror(errno));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
}
int retval = fread(buf, bufLength, 1, f);
fclose(f);
if(retval != 1) {
CPPUNIT_FAIL("return value is not 1");
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
}
}
void MultiDiskAdaptorTest::testWriteData() {
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries(createEntries());
adaptor->setFileEntries(fileEntries.begin(), fileEntries.end());
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->openFile();
std::string msg = "12345";
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->writeData((const unsigned char*)msg.c_str(), msg.size(), 0);
adaptor->closeFile();
CPPUNIT_ASSERT(File("file0.txt").isFile());
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
char buf[128];
readFile("file1.txt", buf, 5);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
buf[5] = '\0';
CPPUNIT_ASSERT_EQUAL(msg, std::string(buf));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->openFile();
std::string msg2 = "67890ABCDEF";
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->writeData((const unsigned char*)msg2.c_str(), msg2.size(), 5);
adaptor->closeFile();
readFile("file1.txt", buf, 15);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
buf[15] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("1234567890ABCDE"), std::string(buf));
readFile("file2.txt", buf, 1);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
buf[1] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("F"), std::string(buf));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->openFile();
std::string msg3 = "12345123456712";
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->writeData((const unsigned char*)msg3.c_str(), msg3.size(), 10);
adaptor->closeFile();
readFile("file1.txt", buf, 15);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
buf[15] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("123456789012345"), std::string(buf));
readFile("file2.txt", buf, 7);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
buf[7] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("1234567"), std::string(buf));
CPPUNIT_ASSERT(File("file3.txt").isFile());
readFile("file4.txt", buf, 2);
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
buf[2] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("12"), std::string(buf));
CPPUNIT_ASSERT(File("file5.txt").isFile());
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
}
void MultiDiskAdaptorTest::testReadData() {
SharedHandle<FileEntry> entry1(new FileEntry("file1r.txt", 15, 0));
SharedHandle<FileEntry> entry2(new FileEntry("file2r.txt", 7, 15));
SharedHandle<FileEntry> entry3(new FileEntry("file3r.txt", 3, 22));
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > entries;
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
entries.push_back(entry1);
entries.push_back(entry2);
entries.push_back(entry3);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor->setFileEntries(entries.begin(), entries.end());
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->openFile();
unsigned char buf[128];
adaptor->readData(buf, 15, 0);
buf[15] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("1234567890ABCDE"), std::string((char*)buf));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->readData(buf, 10, 6);
buf[10] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("7890ABCDEF"), std::string((char*)buf));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->readData(buf, 4, 20);
buf[4] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("KLMN"), std::string((char*)buf));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
adaptor->readData(buf, 25, 0);
buf[25] = '\0';
CPPUNIT_ASSERT_EQUAL(std::string("1234567890ABCDEFGHIJKLMNO"), std::string((char*)buf));
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> To add an ability to pre-allocate file space: * src/DirectDiskAdaptor.h: Rewritten. * src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle * src/MultiDiskAdaptor.h: Rewritten. * src/DefaultPieceStorage.cc (MultiDiskWriter.h): Removed include. (PreAllocationDiskWriter.h): Removed include. (FileAllocationMonitor.h): New include. (~DefaultPieceStorage): Removed deletion of diskAdaptor. (initStorage): Rewritten. (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileAllocator.h: New class. * src/FileAllocator.cc: New class. * src/FileAllocationMonitor.h: New class. * src/FileAllocationMonitor.cc: New class. * src/ConsoleFileAllocationMonitor.h: New class. * src/ConsoleFileAllocationMonitor.cc: New class. * src/AbstractSingleDiskAdaptor.h: New class. * src/AbstractSingleDiskAdaptor.cc: New class. * src/DiskAdaptor.h (Directory.h): Removed include. (DiskWriter.h): Removed include. (FileEntry.h): Removed include. (diskWriter): Removed. (DiskAdaptor): Removed diskWriter. (openFile): Made pure virtual. (closeFile): Made pure virtual. (openExistingFile): Made pure virtual. (initAndOpenFile): Made pure virtual. (writeData): Made pure virtual. (readData): Made pure virtual. (sha1Sum): Made pure virtual. (getStoreDir): Returns const reference of storeDir. (DiskAdaptorHandle): New type definition. * src/main.cc (ConsoleFileAllocationMonitor.h): New include. (showUsage): Added default value description of -s option. Added the description of --file-allocation option. (main): Set default value of --file-allocation option to 'none'. Added --file-allocation command-line option. Setup FileAllocationMonitorFactory. * src/FtpInitiateConnectionCommand.cc (executeInternal): Removed diskWriter related processing, which was moved to FtpNegotiationCommand.cc. * src/DirectDiskAdaptor.cc (getFilePath): Made non-const. * src/CopyDiskAdaptor.h (DiskAdaptor.h): Removed include. (DiskWriter.h): Removed include. (AbstractSingleDiskAdaptor.h): New include. (getFilePath): Made non-const. Added virtual keyword. (CopyDiskAdaptor): Removed diskWriter. (getTempFile): Returns const reference. (CopyDiskAdaptorHandle): New type definition. * src/ByteArrayDiskWriter.cc (clear): Simplified. (initAndOpenFile): Rewritten. (openFile): Call initAndOpenFile() * src/MultiDiskAdaptor.cc: Rewritten. * src/DownloadEngineFactory.cc (FileAllocator.h): New include. (FileAllocationMonitor.h): New include. (newConsoleEngine): Call DefaultDiskWriter::createNewDiskWriter() to create DefaultDiskWriter with file allocator. * src/DiskWriter.h (initAndOpenFile): Added totalLength argument. (openFile): Added totalLength argument. * src/prefs.h (PREF_FILE_ALLOCATION): New definition. (V_PREALLOC): New definition. (V_NONE): New definition. * src/HttpResponseCommand.cc (handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile with size. * src/FtpNegotiateCommand.cc (Util.h): New include. (recvSize): Open file here. * src/Util.h (ullitos): New function. * src/CopyDiskWriter.h (getFilePath): Made non-const. * src/DefaultDiskWriter.h (Option.h): New include. (totalLength): Removed. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added totalLength argument. (DefaultDiskWriterHandle): New type definition. (createNewDiskWriter): New function. * src/Util.cc (ullitos): New function. * src/DefaultDiskWriter.cc (message.h): New include. (FileAllocator.h): New include. (prefs.h): New include. (Util.h): New include. (DefaultDiskWriter): Removed totalLength. (initAndOpenFile): Added file allocation. (createNewDiskWriter): New function. Just for temporary solution. It will be rewritten later. * src/DiskAdaptor.cc (DiskAdaptor): Removed diskWriter. * src/AbstractDiskWriter.cc (LogFactory.h): New include. (AbstractDiskWriter): Added fileAllocator, logger. (openFile): Added totalLength argument. * src/AbstractDiskWriter.h (FileAllocator.h): New include. (Logger.h): New include. (fileAllocator): New variable. (logger): New variable. (openFile): Added totalLength argument. Added virtual keyword explicitly. (openExistingFile): Added totalLength argument. Added virtual keyword explicitly. (closeFile): Added virtual keyword explicitly. (sha1Sum): Added virtual keyword explicitly. (writeData): Added virtual keyword explicitly. (readData): Added virtual keyword explicitly. (setFileAllocator): New function. * src/DefaultPieceStorage.h (FileAllocator.h): New include. (diskAdaptor): DiskAdaptor -> DiskAdaptorHandle (getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle * src/FileProgressMonitor.h: New class. To compile aria2 on PC-BSD: * src/DefaultBtContext.cc (libgen.h): New include. To fix memory leak: * src/Exception.h (~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
}
void MultiDiskAdaptorTest::testCutTrailingGarbage()
{
std::string dir = "/tmp";
std::string prefix = "aria2_MultiDiskAdaptorTest_testCutTrailingGarbage_";
SharedHandle<FileEntry> entries[] = {
SharedHandle<FileEntry>(new FileEntry(dir+"/"+prefix+"1", 256, 0)),
SharedHandle<FileEntry>(new FileEntry(dir+"/"+prefix+"2", 512, 256))
};
for(size_t i = 0; i < arrayLength(entries); ++i) {
createFile(entries[i]->getPath(), entries[i]->getLength()+100);
}
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries
(&entries[0], &entries[arrayLength(entries)]);
MultiDiskAdaptor adaptor;
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor.setFileEntries(fileEntries.begin(), fileEntries.end());
adaptor.setMaxOpenFiles(1);
adaptor.setPieceLength(1);
adaptor.openFile();
adaptor.cutTrailingGarbage();
CPPUNIT_ASSERT_EQUAL((uint64_t)256,
File(entries[0]->getPath()).size());
CPPUNIT_ASSERT_EQUAL((uint64_t)512,
File(entries[1]->getPath()).size());
}
void MultiDiskAdaptorTest::testSize()
{
std::string dir = "/tmp";
std::string prefix = "aria2_MultiDiskAdaptorTest_testSize_";
SharedHandle<FileEntry> entries[] = {
SharedHandle<FileEntry>(new FileEntry(dir+"/"+prefix+"1", 1, 0)),
SharedHandle<FileEntry>(new FileEntry(dir+"/"+prefix+"2", 1, 1))
};
for(size_t i = 0; i < arrayLength(entries); ++i) {
createFile(entries[i]->getPath(), entries[i]->getLength());
}
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries
(&entries[0], &entries[arrayLength(entries)]);
MultiDiskAdaptor adaptor;
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor.setFileEntries(fileEntries.begin(), fileEntries.end());
adaptor.setMaxOpenFiles(1);
adaptor.setPieceLength(1);
adaptor.openFile();
CPPUNIT_ASSERT_EQUAL((uint64_t)2, adaptor.size());
}
void MultiDiskAdaptorTest::testUtime()
{
std::string storeDir = "/tmp/aria2_MultiDiskAdaptorTest_testUtime";
SharedHandle<FileEntry> entries[] = {
SharedHandle<FileEntry>(new FileEntry(storeDir+"/requested", 0, 0)),
SharedHandle<FileEntry>(new FileEntry(storeDir+"/notFound", 0, 0)),
SharedHandle<FileEntry>(new FileEntry(storeDir+"/notRequested", 0, 0)),
SharedHandle<FileEntry>(new FileEntry(storeDir+"/anotherRequested", 0, 0)),
};
createFile(entries[0]->getPath(), entries[0]->getLength());
File(entries[1]->getPath()).remove();
createFile(entries[2]->getPath(), entries[2]->getLength());
createFile(entries[3]->getPath(), entries[3]->getLength());
entries[2]->setRequested(false);
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
std::vector<SharedHandle<FileEntry> > fileEntries
(&entries[0], &entries[arrayLength(entries)]);
MultiDiskAdaptor adaptor;
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> Rewritten DownloadContext and removed SingleFileDownloadContext and BtContext and its derived classes. BitTorrent specific attributes are now set by DownloadContext::setAttribute() with key bittorrent::BITTORRENT. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyResponseCommand.cc * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/AnnounceList.cc * src/BtCheckIntegrityEntry.cc * src/BtConstants.h * src/BtContext.h: Removed * src/BtDependency.cc * src/BtExtendedMessage.cc * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPostDownloadHandler.cc * src/BtRegistry.cc * src/BtRegistry.h * src/BtSetup.cc * src/CheckIntegrityCommand.cc * src/CheckIntegrityEntry.cc * src/ChecksumCheckIntegrityEntry.cc * src/ConsoleStatCalc.cc * src/ContentTypeRequestGroupCriteria.cc * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTTaskFactory.h * src/DHTTaskFactoryImpl.cc * src/DHTTaskFactoryImpl.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtContext.cc: Removed * src/DefaultBtContext.h: Removed * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtMessageFactory.cc * src/DefaultBtMessageFactory.h * src/DefaultBtMessageReceiver.cc * src/DefaultBtMessageReceiver.h * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/DefaultPeerStorage.cc * src/DefaultPeerStorage.h * src/DefaultPieceStorage.cc * src/DefaultSegmentManFactory.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngineFactory.cc * src/DownloadHandler.cc * src/DownloadResult.h * src/FileAllocationCommand.cc * src/FileAllocationDispatcherCommand.cc * src/FileAllocationEntry.cc * src/FileEntry.h * src/FillRequestGroupCommand.cc * src/FtpDownloadCommand.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/HaveEraseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpServerBodyCommand.cc * src/HttpServerCommand.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/Makefile.in * src/Metalink2RequestGroup.cc * src/MetalinkPostDownloadHandler.cc * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/MultiFileAllocationIterator.cc * src/MultiUrlRequestInfo.cc * src/PeerChokeCommand.cc * src/PeerChokeCommand.h * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/PeerReceiveHandshakeCommand.cc * src/PieceHashCheckIntegrityEntry.cc * src/RealtimeCommand.cc * src/ReceiverMSEHandshakeCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupEntry.cc * src/RequestGroupMan.cc * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SegmentMan.cc * src/ShareRatioSeedCriteria.h * src/SingleFileDownloadContext.cc: Removed * src/SingleFileDownloadContext.h: Removed * src/SleepCommand.cc * src/StreamCheckIntegrityEntry.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.h * src/UnknownLengthPieceStorage.cc * src/Util.cc * src/Util.h * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/bittorrent_helper.h * src/download_helper.cc * src/main.cc * src/option_processing.cc * test/BitfieldManTest.cc * test/BittorrentHelperTest.cc * test/BtCancelMessageTest.cc * test/BtChokeMessageTest.cc * test/BtDependencyTest.cc * test/BtPieceMessageTest.cc * test/BtPostDownloadHandlerTest.cc * test/BtRegistryTest.cc * test/BtRejectMessageTest.cc * test/BtRequestMessageTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultBtAnnounceTest.cc * test/DefaultBtContextTest.cc: Removed * test/DefaultBtMessageDispatcherTest.cc * test/DefaultBtMessageFactoryTest.cc * test/DefaultBtProgressInfoFileTest.cc * test/DefaultBtRequestFactoryTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/DefaultPeerStorageTest.cc * test/DefaultPieceStorageTest.cc * test/DirectDiskAdaptorTest.cc * test/DownloadContextTest.cc * test/DownloadHandlerFactoryTest.cc * test/DownloadHelperTest.cc * test/HandshakeExtensionMessageTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/MSEHandshakeTest.cc * test/Makefile.am * test/Makefile.in * test/Metalink2RequestGroupTest.cc * test/MetalinkPostDownloadHandlerTest.cc * test/MockBtContext.h: Removed * test/MockDHTTaskFactory.h * test/MockDownloadContext.h: Removed * test/MockPieceStorage.h * test/MultiDiskAdaptorTest.cc * test/MultiFileAllocationIteratorTest.cc * test/RequestGroupManTest.cc * test/RequestGroupTest.cc * test/SegmentManTest.cc * test/ShareRatioSeedCriteriaTest.cc * test/SingleFileDownloadContextTest.cc: Removed * test/UtilTest.cc * test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
adaptor.setFileEntries(fileEntries.begin(), fileEntries.end());
2008-11-22 20:28:50 +00:00
time_t atime = (time_t) 100000;
time_t mtime = (time_t) 200000;
2008-11-22 20:28:50 +00:00
CPPUNIT_ASSERT_EQUAL((size_t)2, adaptor.utime(Time(atime), Time(mtime)));
CPPUNIT_ASSERT_EQUAL((time_t)mtime,
File(entries[0]->getPath()).getModifiedTime().getTime());
2008-11-22 20:28:50 +00:00
CPPUNIT_ASSERT_EQUAL((time_t)mtime,
File(entries[3]->getPath()).getModifiedTime().getTime());
CPPUNIT_ASSERT((time_t)mtime !=
File(entries[2]->getPath()).getModifiedTime().getTime());
}
} // namespace aria2