Commit Graph

442 Commits (933866e315cc40f010a095c7eb030c801591208d)

Author SHA1 Message Date
Tatsuhiro Tsujikawa 4cb5468662 2009-05-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Now RequestGroup has its own copy of Option object. This will help
	to give custom option for each RequestGroup.
	addTorrentFile command now takes options.
	* src/AbstractCommand.cc
	* src/AbstractCommand.h
	* src/AbstractProxyRequestCommand.cc
	* src/ActivePeerConnectionCommand.cc
	* src/ActivePeerConnectionCommand.h
	* src/AdaptiveURISelector.cc
	* src/BtCheckIntegrityEntry.cc
	* src/BtDependency.cc
	* src/BtDependency.h
	* src/BtFileAllocationEntry.cc
	* src/BtPostDownloadHandler.cc
	* src/CheckIntegrityEntry.cc
	* src/DownloadCommand.cc
	* src/FtpDownloadCommand.cc
	* src/FtpFinishDownloadCommand.cc
	* src/FtpInitiateConnectionCommand.cc
	* src/FtpNegotiationCommand.cc
	* src/HttpInitiateConnectionCommand.cc
	* src/HttpRequestCommand.cc
	* src/HttpResponseCommand.cc
	* src/HttpSkipResponseCommand.cc
	* src/InitiateConnectionCommand.cc
	* src/InitiateConnectionCommandFactory.cc
	* src/InitiatorMSEHandshakeCommand.cc
	* src/InitiatorMSEHandshakeCommand.h
	* src/Metalink2RequestGroup.cc
	* src/Metalink2RequestGroup.h
	* src/MetalinkPostDownloadHandler.cc
	* src/MultiUrlRequestInfo.cc
	* src/MultiUrlRequestInfo.h
	* src/PeerAbstractCommand.cc
	* src/PeerInteractionCommand.cc
	* src/PeerInteractionCommand.h
	* src/PeerReceiveHandshakeCommand.cc
	* src/PeerReceiveHandshakeCommand.h
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/TrackerWatcherCommand.cc
	* src/TrackerWatcherCommand.h
	* src/XmlRpcMethod.cc
	* src/XmlRpcMethod.h
	* src/XmlRpcMethodImpl.cc
	* src/download_helper.cc
	* src/download_helper.h
	* src/main.cc
	* test/BtDependencyTest.cc
	* test/BtPostDownloadHandlerTest.cc
	* test/DefaultBtMessageDispatcherTest.cc
	* test/DownloadHandlerFactoryTest.cc
	* test/DownloadHelperTest.cc
	* test/Metalink2RequestGroupTest.cc
	* test/MetalinkPostDownloadHandlerTest.cc
	* test/RequestGroupManTest.cc
	* test/RequestGroupTest.cc
2009-05-08 16:41:21 +00:00
Tatsuhiro Tsujikawa b57b75f98d 2009-05-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added xml-rpc functionality. Currently only addURI commad is
	supported. To enable xml-rpc, run aria2 with
	--enable-http-server. This option name is temporal and will be
	changed. The feature that reports download progress in html format
	is temporarily disabled.
	* src/HttpServer.cc
	* src/HttpServer.h
	* src/HttpServerBodyCommand.cc
	* src/HttpServerBodyCommand.h
	* src/HttpServerCommand.cc
	* src/HttpServerResponseCommand.cc
	* src/Makefile.am
	* src/OptionParser.cc
	* src/OptionParser.h
	* src/RequestGroupMan.cc
	* src/RequestGroupMan.h
	* src/XmlRpcMethod.cc
	* src/XmlRpcMethod.h
	* src/XmlRpcMethodFactory.cc
	* src/XmlRpcMethodFactory.h
	* src/XmlRpcMethodImpl.cc
	* src/XmlRpcMethodImpl.h
	* src/download_helper.cc
	* src/download_helper.h
	* test/Makefile.am
	* test/XmlRpcMethodTest.cc
2009-05-08 07:58:50 +00:00
Tatsuhiro Tsujikawa 3a81b3c3d7 2009-05-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added xml-rpc request parser. The supported value types are:
	i4/int, string, double, struct, array, base64.  Currently only
	libxml2 version is provided.
	* src/Xml2XmlRpcRequestProcessor.cc
	* src/Xml2XmlRpcRequestProcessor.h
	* src/XmlRpcElements.cc
	* src/XmlRpcElements.h
	* src/XmlRpcRequest.h
	* src/XmlRpcRequestParserController.cc
	* src/XmlRpcRequestParserController.h
	* src/XmlRpcRequestParserState.h
	* src/XmlRpcRequestParserStateImpl.cc
	* src/XmlRpcRequestParserStateImpl.h
	* src/XmlRpcRequestParserStateMachine.cc
	* src/XmlRpcRequestParserStateMachine.h
	* src/XmlRpcRequestProcessor.h
	* test/XmlRpcRequestParserControllerTest.cc
	* test/XmlRpcRequestProcessorTest.cc
2009-05-08 03:24:24 +00:00
Tatsuhiro Tsujikawa ce9c79a2f3 2009-05-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Pass reference of Option object instead of pointer.
	* src/download_helper.cc
	* src/download_helper.h
	* src/main.cc
	* test/DownloadHelperTest.cc
2009-05-07 08:52:38 +00:00
Tatsuhiro Tsujikawa 4da631bef6 2009-05-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Moved piece statistics stuff to new PieceStatMan class.
	Refactored PieceSelector interface.
	* src/DefaultPieceStorage.cc
	* src/DefaultPieceStorage.h
	* src/LongestSequencePieceSelector.cc
	* src/LongestSequencePieceSelector.h
	* src/Makefile.am
	* src/PieceSelector.h
	* src/PieceStatMan.cc
	* src/PieceStatMan.h
	* src/RarestPieceSelector.cc
	* src/RarestPieceSelector.h
	* src/RequestGroup.cc
	* test/DefaultPieceStorageTest.cc
	* test/InOrderPieceSelector.h
	* test/Makefile.am
	* test/PieceStatManTest.cc
	* test/RarestPieceSelectorTest.cc
2009-05-06 07:49:22 +00:00
Tatsuhiro Tsujikawa d05d8bbddc 2009-05-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added static member _protocolFamily to SocketCore.  By default,
	SocketCore uses AF_UNSPEC for getaddrinfo hints to resolve
	address. Sometime SocketCore::bind() and
	SocketCore::establishConnection() use difference protocl family
	and latter cannot connect to former. To avoid this situation, we
	limit protocol family to AF_INET for unit tests.
	* src/SocketCore.cc
	* src/SocketCore.h
	* test/AllTest.cc
2009-05-06 07:42:59 +00:00
Tatsuhiro Tsujikawa 3511aad188 2009-05-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Applied Pascal Bleser's patch: increases MAX_RECV_BUFFER for ftp
	from 4096 to 65536 (for insanely large ftp login banners)
	* src/FtpConnection.h
	* test/FtpConnectionTest.cc
2009-05-05 03:27:45 +00:00
Tatsuhiro Tsujikawa 8fe80169b3 2009-05-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
In DefaultBtContext::getActualBasePath(), return first
	FileEntry::getPath() for single file torrent.	
	* src/DefaultBtContext.cc
	* test/DefaultBtContextTest.cc
2009-05-05 03:20:56 +00:00
Tatsuhiro Tsujikawa c1aef8e2d1 2009-05-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Now the constructor of AbstractDiskWriter takes filename as an
	argument and filename argument is removed from openFile(),
	initAndOpenFile(), openExistingFile() interface.  storeDir
	member and its accessor functions are removed from DiskAdaptor
	because it is not used anymore.  size() member function of
	DefaultDiskWriter, DirectDiskAdaptor and MultiDiskAdaptor now
	can be called without opening file.
	* src/AbstractDiskWriter.cc
	* src/AbstractDiskWriter.h
	* src/AbstractSingleDiskAdaptor.cc
	* src/AbstractSingleDiskAdaptor.h
	* src/ByteArrayDiskWriter.cc
	* src/ByteArrayDiskWriter.h
	* src/ByteArrayDiskWriterFactory.cc
	* src/ByteArrayDiskWriterFactory.h
	* src/DefaultDiskWriter.cc
	* src/DefaultDiskWriter.h
	* src/DefaultDiskWriterFactory.cc
	* src/DefaultDiskWriterFactory.h
	* src/DefaultPieceStorage.cc
	* src/DirectDiskAdaptor.cc
	* src/DirectDiskAdaptor.h
	* src/DiskAdaptor.h
	* src/DiskWriter.h
	* src/DiskWriterFactory.h
	* src/MessageDigestHelper.cc
	* src/MultiDiskAdaptor.cc
	* src/RequestGroup.cc
	* src/UnknownLengthPieceStorage.cc
	* src/Util.cc
	* test/DefaultDiskWriterTest.cc
	* test/DirectDiskAdaptorTest.cc
	* test/FallocFileAllocationIteratorTest.cc
	* test/MessageDigestHelperTest.cc
	* test/MetalinkProcessorTest.cc
	* test/MultiDiskAdaptorTest.cc
	* test/MultiFileAllocationIteratorTest.cc
	* test/SingleFileAllocationIteratorTest.cc
	* test/UtilTest.cc
2009-05-04 07:50:38 +00:00
Tatsuhiro Tsujikawa 717fa2a855 2009-05-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Code cleanup
	* test/MockPieceStorage.cc
2009-05-03 11:01:52 +00:00
Tatsuhiro Tsujikawa ee229c6f00 2009-05-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that with --check-integrity option aria2 reports
	downloaded file size is 0 even if some parts of file is
	correctly downloaded.  This bug is reproducible for the download
	that a file includes last piece is missing. This bug doesn't
	reveal for single-torrent with file allocation on.
	* src/IteratableChecksumValidator.cc
	* test/IteratableChecksumValidatorTest.cc
2009-05-03 06:26:44 +00:00
Tatsuhiro Tsujikawa 16f5ebcfcd 2009-04-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed MetalinkProcessorFactory. Since we don't use both
	libxml2 and expat simultaneously, MetalinkProcessor is now not
	base class and it is directly implemented in
	XML2SAXMetalinkProcessor and ExpatMetalinkProcessor.	
	* src/ExpatMetalinkProcessor.cc
	* src/ExpatMetalinkProcessor.h
	* src/Makefile.am
	* src/MetalinkHelper.cc
	* src/MetalinkProcessor.h
	* src/MetalinkProcessorFactory.cc: Removed.
	* src/MetalinkProcessorFactory.h: Removed
	* src/XML2SAXMetalinkProcessor.cc
	* src/XML2SAXMetalinkProcessor.h
	* test/MetalinkProcessorTest.cc
2009-04-28 09:22:43 +00:00
Tatsuhiro Tsujikawa d229909bf8 2009-04-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added missing file.
	* test/Makefile.am
	* test/url-list-singleFileEndsWithSlash.torrent
2009-04-27 12:00:41 +00:00
Tatsuhiro Tsujikawa 49b4cfbfcd 2009-04-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Put BDE in aria2 namespace. BDE will also be used to store
	xml-rpc request.
	* src/AnnounceList.cc
	* src/AnnounceList.h
	* src/BDE.cc: Added
	* src/BDE.h: Added
	* src/DHTAbstractMessage.cc
	* src/DHTAbstractMessage.h
	* src/DHTAnnouncePeerMessage.cc
	* src/DHTAnnouncePeerMessage.h
	* src/DHTAnnouncePeerReplyMessage.cc
	* src/DHTAnnouncePeerReplyMessage.h
	* src/DHTFindNodeMessage.cc
	* src/DHTFindNodeMessage.h
	* src/DHTFindNodeReplyMessage.cc
	* src/DHTFindNodeReplyMessage.h
	* src/DHTGetPeersMessage.cc
	* src/DHTGetPeersMessage.h
	* src/DHTGetPeersReplyMessage.cc
	* src/DHTGetPeersReplyMessage.h
	* src/DHTMessageFactory.h
	* src/DHTMessageFactoryImpl.cc
	* src/DHTMessageFactoryImpl.h
	* src/DHTMessageReceiver.cc
	* src/DHTMessageTracker.cc
	* src/DHTMessageTracker.h
	* src/DHTPingMessage.cc
	* src/DHTPingMessage.h
	* src/DHTPingReplyMessage.cc
	* src/DHTPingReplyMessage.h
	* src/DHTQueryMessage.cc
	* src/DHTQueryMessage.h
	* src/DHTResponseMessage.cc
	* src/DHTResponseMessage.h
	* src/DefaultBtAnnounce.cc
	* src/DefaultBtContext.cc
	* src/DefaultBtContext.h
	* src/HandshakeExtensionMessage.cc
	* src/Makefile.am
	* src/PeerListProcessor.h
	* src/UTPexExtensionMessage.cc
	* src/bencode.cc
	* src/bencode.h
	* test/AnnounceListTest.cc
	* test/BDETest.cc: Added
	* test/BencodeTest.cc
	* test/DHTAnnouncePeerMessageTest.cc
	* test/DHTAnnouncePeerReplyMessageTest.cc
	* test/DHTFindNodeMessageTest.cc
	* test/DHTFindNodeReplyMessageTest.cc
	* test/DHTGetPeersMessageTest.cc
	* test/DHTGetPeersReplyMessageTest.cc
	* test/DHTMessageFactoryImplTest.cc
	* test/DHTMessageTrackerTest.cc
	* test/DHTPingMessageTest.cc
	* test/DHTPingReplyMessageTest.cc
	* test/Makefile.am
	* test/MockDHTMessageFactory.h
	* test/PeerListProcessorTest.cc
2009-04-27 11:45:22 +00:00
Tatsuhiro Tsujikawa d58742ad21 2009-04-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use url-list (web-seeding) only for single-file torrent.  This
	is basically the same behavior with Metalink file with torrent
	and URIs.
	* src/RequestGroup.cc
	* src/DefaultBtContext.cc
	* test/DefaultBtContextTest.cc
2009-04-27 06:55:10 +00:00
Tatsuhiro Tsujikawa 1ea7fca02b 2009-04-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten expr
	* src/array_fun.h
	* test/array_funTest.cc
2009-04-25 17:04:32 +00:00
Tatsuhiro Tsujikawa e385c68f52 2009-04-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed ExtendedMessagingAware. Instead of using inheritance,
	added ExtensionMessageRegistry and it is passed to
	DefaultExtensionMessageFactory.
	* src/DefaultBtInteractive.cc
	* src/DefaultBtInteractive.h
	* src/DefaultExtensionMessageFactory.cc
	* src/DefaultExtensionMessageFactory.h
	* src/ExtendedMessagingAware.h: Removed.
	* src/ExtensionMessageFactory.h
	* src/ExtensionMessageRegistry.h: Added.
	* src/Makefile.am
	* src/PeerInteractionCommand.cc
	* test/DefaultExtensionMessageFactoryTest.cc
2009-04-25 10:48:00 +00:00
Tatsuhiro Tsujikawa 35763a2ae0 2009-04-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that prevents torrent download from finishing.
	The bug doesn't reveal for all torrents. The torrents affected
	this bug satisfies ((N+7)/8)%4 == 0 and N%32 != 0 where N is the
	number of pieces.	
	* src/bitfield.h
	* test/bitfieldTest.cc
2009-04-25 10:30:25 +00:00
Tatsuhiro Tsujikawa 6703097652 2009-04-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten PeerListProcessor
	* src/PeerListProcessor.h
	* src/CompactPeerListProcessor.h: Removed
	* src/CompactPeerListProcessor.cc: Removed
	* src/DelegatingPeerListProcessor.cc: Removed.
	* src/DefaultBtAnnounce.cc
	* src/Makefile.am
	* src/UTPexExtensionMessage.cc
	* src/DefaultPeerListProcessor.h: Removed.
	* src/DefaultPeerListProcessor.cc: Removed.
	* src/DelegatingPeerListProcessor.h: Removed.
	* test/Makefile.am
	* test/PeerListProcessorTest.cc
	* test/DefaultPeerListProcessorTest.cc: Removed.
2009-04-23 13:39:53 +00:00
Tatsuhiro Tsujikawa afdd61f9d1 2009-04-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten event dispatch in BtMessage. Removed BtEventListener,
	BtEvent.	
	* src/AbstractBtEventListener.h: Removed.
	* src/AbstractBtMessage.cc
	* src/AbstractBtMessage.h
	* src/BtAbortOutstandingRequestEvent.h
	* src/BtCancelSendingPieceEvent.h
	* src/BtChokedEvent.h: Removed.
	* src/BtChokingEvent.h
	* src/BtEvent.h: Removed
	* src/BtEventListener.h: Removed.
	* src/BtMessage.h
	* src/BtPieceMessage.cc
	* src/BtPieceMessage.h
	* src/BtRequestMessage.cc
	* src/BtRequestMessage.h
	* src/DefaultBtMessageDispatcher.cc
	* src/Makefile.am
	* src/a2functional.h
	* test/BtPieceMessageTest.cc
	* test/BtRequestMessageTest.cc
	* test/DefaultBtMessageDispatcherTest.cc
	* test/MockBtMessage.h
2009-04-21 14:52:04 +00:00
Tatsuhiro Tsujikawa 65a358c68b 2009-04-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed segmentation fault when GZipDecoder::decode() returns 0
	byte.
	* src/DownloadCommand.cc
	* src/bitfield.h
	* test/bitfieldTest.cc

	Fixed the bug that causes infinite loop if broken web server
	returns chunked response without last "0" chunk-size marker and
	closes connection.
	* src/DownloadCommand.cc

	Instantiate properly configured HttpDownloadCommand for
	non-resumable downlaods.
	* src/HttpResponseCommand.cc
2009-04-17 13:19:17 +00:00
Tatsuhiro Tsujikawa d2d4f67bbe 2009-04-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten array operation functions.
	* src/BitfieldMan.cc
	* src/array_fun.h
	* test/array_funTest.cc
2009-04-16 13:43:23 +00:00
Tatsuhiro Tsujikawa 0e70ba46a9 2009-04-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Increase prefixLength for the bucket which doesn't own local
	node ID when splitting bucket.
	* src/DHTBucket.cc
	* test/DHTBucketTest.cc
2009-04-13 12:47:50 +00:00
Tatsuhiro Tsujikawa becd34bcb9 2009-04-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that removed peer's session upload/download length
	are counted twice in _cachedTransferStat before it is
	re-calculated.  This affected the calculation of shara ratio,
	resulting aria2 wrongly determines that specified share ratio is
	reached. Also fixed the typo in calculateStatFor function name.
	* src/BtSetup.cc
	* src/DefaultPeerStorage.cc
	* src/ShareRatioSeedCriteria.h
	* test/ShareRatioSeedCriteriaTest.cc
2009-04-05 10:38:15 +00:00
Tatsuhiro Tsujikawa 5541477dce 2009-04-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten isInRange()
	* src/DHTBucket.cc
	* test/DHTBucketTest.cc
2009-04-01 12:28:39 +00:00
Tatsuhiro Tsujikawa a6b02840fa 2009-03-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
BitfieldMan::getMissingIndexes family functions now takes
	unsigned char* bitfield instead of stl container for efficiency.
	PieceSelector::select now takes this
	bitfield. RarestPieceSelector::select now also performs
	efficiently for this change.  bitfield namespace is introduced
	and it has several helper functions to handle basic bitfield
	operations such as test, count set bits, etc.
	* src/BitfieldMan.cc
	* src/BitfieldMan.h
	* src/DefaultBtRequestFactory.cc
	* src/DefaultPieceStorage.cc
	* src/DefaultPieceStorage.h
	* src/LongestSequencePieceSelector.cc
	* src/LongestSequencePieceSelector.h
	* src/Makefile.am
	* src/Piece.cc
	* src/Piece.h
	* src/PieceSelector.h
	* src/RarestPieceSelector.cc
	* src/RarestPieceSelector.h
	* src/Util.cc
	* src/Util.h
	* src/bitfield.h
	* test/BitfieldManTest.cc
	* test/LongestSequencePieceSelectorTest.cc
	* test/Makefile.am
	* test/RarestPieceSelectorTest.cc
	* test/UtilTest.cc
	* test/bitfieldTest.cc
2009-03-28 13:29:38 +00:00
Tatsuhiro Tsujikawa 29c5ef9215 2009-03-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added 'falloc' parameter for --file-allocation option.  'falloc'
	allocation mode uses posix_fallocate() system call to allocate
	file on disk.  If you are using newer file systems such as ext4
        (with extents support), btrfs or xfs, 'falloc' is your best
	choice. It allocates large(few GiB) files almost instantly.
	Don't use 'falloc' with legacy file systems such as ext3 because
	it takes almost same time as 'prealloc' and it blocks aria2
	entirely until allocation finishes. 'falloc' may not be
	available if your system doesn't have posix_fallocate() system
	call.
	* configure.ac
	* src/AbstractDiskWriter.cc
	* src/AbstractDiskWriter.h
	* src/AbstractSingleDiskAdaptor.cc
	* src/BinaryStream.h
	* src/BtCheckIntegrityEntry.cc
	* src/ByteArrayDiskWriter.h
	* src/CheckIntegrityEntry.cc
	* src/CheckIntegrityEntry.h
	* src/DefaultPieceStorage.cc
	* src/DiskAdaptor.cc
	* src/DiskAdaptor.h
	* src/DiskWriter.h
	* src/FallocFileAllocationIterator.cc
	* src/FallocFileAllocationIterator.h
	* src/FileAllocationEntry.cc
	* src/FileAllocationEntry.h
	* src/Makefile.am
	* src/MultiFileAllocationIterator.cc
	* src/MultiFileAllocationIterator.h
	* src/OptionHandlerFactory.cc
	* src/RequestGroup.cc
	* src/StreamCheckIntegrityEntry.cc
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* test/FallocFileAllocationIteratorTest.cc
	* test/Makefile.am
2009-03-25 05:43:07 +00:00
Tatsuhiro Tsujikawa 289ae1b635 2009-03-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced std::vector<SharedHandle<PieceStats> _sortedPieceStats
	with std::vector<size_t> _sortedPieceStatIndexes to reduce the
	cost of std::rotate().
	* src/RarestPieceSelector.cc
	* src/RarestPieceSelector.h
	* test/RarestPieceSelectorTest.cc
2009-03-24 15:24:30 +00:00
Tatsuhiro Tsujikawa 662a90ce9b 2009-03-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Refactored RarestPieceSelector to reduce CPU load, especially
	for addPieceStats.	
	* src/RarestPieceSelector.cc
	* src/RarestPieceSelector.h
2009-03-20 13:37:53 +00:00
Tatsuhiro Tsujikawa e3ed6adf91 2009-03-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Reduced the number of calls to PeerStorage::calculateStat() and
	SegmentMan::calculateDownloadSpeed() to lower CPU usage on
	higher transfer rate.	
	* src/DefaultBtInteractive.cc
	* src/DefaultBtMessageDispatcher.cc
	* src/DefaultPeerStorage.cc
	* src/DefaultPeerStorage.h
	* src/DownloadCommand.cc
	* src/DownloadEngine.cc
	* src/PeerStorage.h
	* src/SegmentMan.cc
	* src/SegmentMan.h
	* test/MockPeerStorage.h
2009-03-19 13:42:10 +00:00
Tatsuhiro Tsujikawa 75a525b031 2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Prepended _dir+"/" after joining path elements in torrent file.
	* src/DefaultBtContext.cc
	* test/DefaultBtContextTest.cc
2009-03-13 16:10:28 +00:00
Tatsuhiro Tsujikawa c211a2aa4c 2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Slice/joinPath for name of single torrent.
	* src/DefaultBtContext.cc
	* test/DefaultBtContextTest.cc
2009-03-13 13:42:19 +00:00
Tatsuhiro Tsujikawa 87f4fda22f 2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed ServerStatURISelector as FeedbackURISelector.
	* src/FeedbackURISelector.cc
	* src/FeedbackURISelector.h
	* src/Makefile.am
	* src/RequestGroupMan.cc
	* src/ServerStatURISelector.cc
	* src/ServerStatURISelector.h
	* test/FeedbackURISelectorTest.cc
	* test/Makefile.am
	* test/ServerStatURISelectorTest.cc
2009-03-13 12:44:58 +00:00
Tatsuhiro Tsujikawa 15582ed8cd 2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Refactored BtMessage subclasses. BtCancelMessage,
	BtRequestMessage and BtRejectMessage are derived from
	RangeBtMessage class.
	BtAllowedFastMessage, BtHaveMessage and BtSuggestPieceMessage
	are derived from IndexBtMessage class. BtChokeMessage,
	BtHaveAllMessage, BtHaveNoneMessage, BtInterestedMessage,
	BtNotInterestedMessage and BtUnchokeMessage are derived from
	ZeroBtMessage class.
	* src/AbstractBtMessage.cc
	* src/AbstractBtMessage.h
	* src/BtAllowedFastMessage.cc
	* src/BtAllowedFastMessage.h
	* src/BtAllowedFastMessageValidator.h: Removed
	* src/BtBitfieldMessage.cc
	* src/BtBitfieldMessage.h
	* src/BtCancelMessage.cc
	* src/BtCancelMessage.h
	* src/BtCancelMessageValidator.h: Removed
	* src/BtChokeMessage.cc
	* src/BtChokeMessage.h
	* src/BtExtendedMessage.cc
	* src/BtExtendedMessage.h
	* src/BtHandshakeMessage.cc
	* src/BtHandshakeMessage.h
	* src/BtHaveAllMessage.cc
	* src/BtHaveAllMessage.h
	* src/BtHaveMessage.cc
	* src/BtHaveMessage.h
	* src/BtHaveMessageValidator.h: Removed
	* src/BtHaveNoneMessage.cc
	* src/BtHaveNoneMessage.h
	* src/BtInterestedMessage.cc
	* src/BtInterestedMessage.h
	* src/BtKeepAliveMessage.cc
	* src/BtKeepAliveMessage.h
	* src/BtNotInterestedMessage.cc
	* src/BtNotInterestedMessage.h
	* src/BtPieceMessage.cc
	* src/BtPieceMessage.h
	* src/BtPortMessage.cc
	* src/BtPortMessage.h
	* src/BtRejectMessage.cc
	* src/BtRejectMessage.h
	* src/BtRejectMessageValidator.h: Removed
	* src/BtRequestMessage.cc
	* src/BtRequestMessage.h
	* src/BtRequestMessageValidator.h: Removed
	* src/BtSuggestPieceMessage.cc
	* src/BtSuggestPieceMessage.h
	* src/BtSuggestPieceMessageValidator.h: Removed
	* src/BtUnchokeMessage.cc
	* src/BtUnchokeMessage.h
	* src/DefaultBtMessageFactory.cc
	* src/IndexBtMessage.cc
	* src/IndexBtMessage.h
	* src/IndexBtMessageValidator.h
	* src/Makefile.am
	* src/PeerMessageUtil.cc
	* src/PeerMessageUtil.h
	* src/RangeBtMessage.cc
	* src/RangeBtMessage.h
	* src/RangeBtMessageValidator.h
	* src/SimpleBtMessage.cc
	* src/SimpleBtMessage.h
	* src/ZeroBtMessage.cc
	* src/ZeroBtMessage.h
	* test/BtRequestMessageTest.cc
2009-03-12 15:54:43 +00:00
Tatsuhiro Tsujikawa 4e0c03500c 2009-03-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
BtMessage now holds _id attribute.  MESSAGE_LENGTH that is
	declared as non-const previously is now const and defined in
	class definition.
	* src/AbstractBtMessage.cc
	* src/AbstractBtMessage.h
	* src/BtAllowedFastMessage.cc
	* src/BtAllowedFastMessage.h
	* src/BtBitfieldMessage.h
	* src/BtCancelMessage.cc
	* src/BtCancelMessage.h
	* src/BtChokeMessage.cc
	* src/BtChokeMessage.h
	* src/BtExtendedMessage.cc
	* src/BtExtendedMessage.h
	* src/BtHandshakeMessage.cc
	* src/BtHandshakeMessage.h
	* src/BtHaveAllMessage.cc
	* src/BtHaveAllMessage.h
	* src/BtHaveMessage.cc
	* src/BtHaveMessage.h
	* src/BtHaveNoneMessage.cc
	* src/BtHaveNoneMessage.h
	* src/BtInterestedMessage.cc
	* src/BtInterestedMessage.h
	* src/BtKeepAliveMessage.cc
	* src/BtKeepAliveMessage.h
	* src/BtMessage.h
	* src/BtNotInterestedMessage.cc
	* src/BtNotInterestedMessage.h
	* src/BtPieceMessage.h
	* src/BtPortMessage.cc
	* src/BtPortMessage.h
	* src/BtRejectMessage.cc
	* src/BtRejectMessage.h
	* src/BtRequestMessage.cc
	* src/BtRequestMessage.h
	* src/BtSuggestPieceMessage.cc
	* src/BtSuggestPieceMessage.h
	* src/BtUnchokeMessage.cc
	* src/BtUnchokeMessage.h
	* src/SimpleBtMessage.cc
	* src/SimpleBtMessage.h
	* test/MockBtMessage.h
2009-03-11 15:44:04 +00:00
Tatsuhiro Tsujikawa 176c9d2002 2009-03-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed --direct-file-mapping option and CopyDiskAdaptor.
	* src/CopyDiskAdaptor.cc: Removed
	* src/CopyDiskAdaptor.h: Removed
	* src/DefaultPieceStorage.cc
	* src/Makefile.am
	* src/OptionHandlerFactory.cc
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* test/CopyDiskAdaptorTest.cc: Removed
	* test/Makefile.am
2009-03-10 13:08:07 +00:00
Tatsuhiro Tsujikawa 849a533d61 2009-03-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed getName() from DownloadContext. getName() is declared in
	BtContext.
	* src/BtContext.h
	* src/DownloadContext.h
	* src/SingleFileDownloadContext.cc
	* src/SingleFileDownloadContext.h
		
	Removed getFilePath() from DiskAdaptor. getFilePath() is
	declared in AbstractSingleDiskAdaptor.
	* src/AbstractSingleDiskAdaptor.h
	* src/DiskAdaptor.h
	* src/MultiDiskAdaptor.h
	* src/RequestGroup.cc
	
	Removed setTopDir() and getTopDir() and getTopDirPath() from
	MultiDiskAdaptor.
	* src/DefaultPieceStorage.cc
	* src/MultiDiskAdaptor.cc
	* src/MultiDiskAdaptor.h
	* test/MultiDiskAdaptorTest.cc
2009-03-10 12:24:29 +00:00
Tatsuhiro Tsujikawa e2704bd823 2009-03-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
FileEntry::getPath() contains store(top level) directory to
	simplify path handling operation.  In the previous
	implementation, store directory is concatenated to
	FileEntry::getPath() in DownloadContext.
	* src/BtDependency.cc
	* src/BtPostDownloadHandler.cc
	* src/CopyDiskAdaptor.cc
	* src/DefaultBtContext.cc
	* src/DirectDiskAdaptor.cc
	* src/FileEntry.cc
	* src/FileEntry.h
	* src/FtpNegotiationCommand.cc
	* src/HttpResponse.cc
	* src/HttpResponseCommand.cc
	* src/Metalink2RequestGroup.cc
	* src/MultiDiskAdaptor.cc
	* src/MultiDiskAdaptor.h
	* src/MultiFileAllocationIterator.cc
	* src/RequestGroup.cc
	* src/SingleFileDownloadContext.cc
	* src/SingleFileDownloadContext.h
	* src/download_helper.cc
	* test/BtDependencyTest.cc
	* test/CopyDiskAdaptorTest.cc
	* test/DefaultBtContextTest.cc
	* test/DefaultBtProgressInfoFileTest.cc
	* test/DirectDiskAdaptorTest.cc
	* test/DownloadHelperTest.cc
	* test/FileEntryTest.cc
	* test/MultiDiskAdaptorTest.cc
	* test/MultiFileAllocationIteratorTest.cc
	* test/RequestGroupTest.cc
	* test/SingleFileDownloadContextTest.cc
2009-03-09 15:10:26 +00:00
Tatsuhiro Tsujikawa c63ceff5dd 2009-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed compiler waring
	* test/UriListParserTest.cc
2009-03-08 10:17:34 +00:00
Tatsuhiro Tsujikawa f44554a634 2009-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --index-out option to specify each file path for torrent.
	Here index shown in --show-files option is used to specify which
	file path should be altered. For example, to change the file
	path with index=2, use --index-out=2=aria2.tar.bz2. You can use
	this option multiple times: --index-out=1=aria2.tar.bz2
	--index-out=2=aria2-opt.tar.bz2. The short hand form -O is also
	available. This option can be specified in -i list.	
	* src/DefaultBtContext.cc
	* src/DefaultBtContext.h
	* src/MultiDiskAdaptor.cc
	* src/MultiDiskAdaptor.h
	* src/MultiFileAllocationIterator.cc
	* src/OptionHandlerFactory.cc
	* src/OptionHandlerImpl.h
	* src/Util.cc
	* src/Util.h
	* src/download_helper.cc
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* test/DefaultBtContextTest.cc
	* test/MultiDiskAdaptorTest.cc
	* test/MultiFileAllocationIteratorTest.cc
	* test/UtilTest.cc
2009-03-07 03:10:53 +00:00
Tatsuhiro Tsujikawa 4aae48c9b2 2009-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use Util::pathJoin()
	* src/MetalinkParserController.cc
	* test/test.xml
2009-03-04 15:56:56 +00:00
Tatsuhiro Tsujikawa 70a8403575 2009-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added Util::pathJoin()
	* src/Util.h
	* test/UtilTest.cc
2009-03-04 15:53:56 +00:00
Tatsuhiro Tsujikawa 6f0bd778ee 2009-03-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Applied basename function to remove directory element in
	content-disposition value.
	Return empty string if content-disposition value is ".." or ".".
	* src/Util.cc
	* test/UtilTest.cc
2009-03-04 14:49:10 +00:00
Tatsuhiro Tsujikawa 0b29a6e2cf 2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --max-overall-download-limit option.  Now
	--max-upload-limit option is not ignored when
	--max-overall-upload-limit option has non-zero value. aria2
	checks download(upload) speed in the order:
	first checks overall speed limit and if it is not exceeded, then
	checks speed limit per download.  Thus you can specify both
	value. For example, set --max-overall-download-limit=1M and
	--max-download-limit=500K to prevent from one download from
	eating all overall speed limit.
	* src/DefaultBtInteractive.cc
	* src/DefaultBtInteractive.h
	* src/DefaultBtMessageDispatcher.cc
	* src/DefaultBtMessageDispatcher.h
	* src/DownloadCommand.cc
	* src/DownloadCommand.h
	* src/FtpNegotiationCommand.cc
	* src/HttpResponseCommand.cc
	* src/OptionHandlerFactory.cc
	* src/PeerInteractionCommand.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/RequestGroupMan.cc
	* src/RequestGroupMan.h
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* test/DefaultBtMessageDispatcherTest.cc
2009-02-28 11:48:26 +00:00
Tatsuhiro Tsujikawa 1c15b5373c 2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that disk writer is not created even if it shares
	same piece with the preceding file if the length of previous
	file is 0.
	* src/MultiDiskAdaptor.cc
	* test/MultiDiskAdaptorTest.cc
2009-02-27 15:33:07 +00:00
Tatsuhiro Tsujikawa 120e2de096 2009-02-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --http-auth-challenge option.  If it is set to true(by
	default), aria2 sends HTTP authorization header only when it is
	requested by the server. If false is set, then authorization
	header is always sent to the server. This is useful for servers
	that don't respond 401 code when authentication is required.
	There is an exception: if username and password are embedded in
	URI, authorization header is always sent to the server
	regardless of this option.
	* src/AuthConfigFactory.cc
	* src/HttpSkipResponseCommand.cc
	* src/OptionHandlerFactory.cc
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* test/AuthConfigFactoryTest.cc
	* test/HttpRequestTest.cc
2009-02-19 12:02:22 +00:00
Tatsuhiro Tsujikawa eafb1bc615 2009-02-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed function throw list.
	* src/bencode.cc
	* src/bencode.h
	* test/BencodeTest.cc
2009-02-15 11:20:21 +00:00
Tatsuhiro Tsujikawa 34d7cd7a70 2009-02-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Open file in binary mode.
	* src/CookieStorage.cc
	* src/DHTSetup.cc
	* src/DHTUtil.cc
	* src/Netrc.cc
	* src/NsCookieParser.cc
	* src/ProtocolDetector.cc
	* src/RequestGroupMan.cc
	* src/Signature.cc
	* src/bencode.cc
	* src/download_helper.cc
	* src/option_processing.cc
	* test/CookieParserTest.cc
	* test/DefaultBtProgressInfoFileTest.cc
	* test/FileTest.cc
	* test/GZipDecoderTest.cc
	* test/RequestGroupManTest.cc
	* test/SignatureTest.cc
	* test/SingleFileAllocationIteratorTest.cc
	* test/UriListParserTest.cc
2009-02-13 11:28:42 +00:00
Tatsuhiro Tsujikawa 9ce0e78780 2009-02-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added missing call to arrayWrapperConst
	* test/array_funTest.cc
2009-02-12 15:39:07 +00:00
Tatsuhiro Tsujikawa b8b6b5c568 2009-02-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added array_wrapper template.
	* src/array_fun.h
	* test/array_funTest.cc
2009-02-12 13:44:34 +00:00