Commit Graph

19 Commits (126a4bde612eb0e6c48cf2f13ebe3eac45cc71a8)

Author SHA1 Message Date
Tatsuhiro Tsujikawa 215d1d3d0b Made static create function of BtMessage subclass return raw pointer 2012-09-27 23:40:25 +09:00
Tatsuhiro Tsujikawa 7989cd898d Use int or int32_t instead of size_t where suitable 2011-12-09 21:39:43 +09:00
Tatsuhiro Tsujikawa 93e5dbed32 2010-11-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed SharedHandle::isNull(). Instead we added operator* and
	operator unspecified_bool_type. Removed use of WeakHandle and
	replaced with raw pointer.
2010-11-12 12:48:48 +00:00
Tatsuhiro Tsujikawa ca4940622c 2010-06-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Changed naming standards for class member variable: now it looks
	like var_ instead of _var.
2010-06-21 13:51:56 +00:00
Tatsuhiro Tsujikawa 886f8ee58e 2010-03-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed arrayLength. Defined A2_ARRAY_LEN as macro to calculate
	size of array at compile time.
	* src/array_fun.h
	* test/BitfieldManTest.cc
	* test/BtPortMessageTest.cc
	* test/DHTRoutingTableDeserializerTest.cc
	* test/DHTRoutingTableSerializerTest.cc
	* test/DownloadHelperTest.cc
	* test/LongestSequencePieceSelectorTest.cc
	* test/MultiDiskAdaptorTest.cc
	* test/OptionParserTest.cc
	* test/PriorityPieceSelectorTest.cc
	* test/array_funTest.cc
2010-03-25 14:22:43 +00:00
Tatsuhiro Tsujikawa 8b73c2843f 2010-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Reduced copying/std::string instantiation in sending/receiving
	BitTorrent messages.
	* src/BtBitfieldMessage.cc
	* src/BtBitfieldMessage.h
	* src/BtExtendedMessage.cc
	* src/BtExtendedMessage.h
	* src/BtHandshakeMessage.cc
	* src/BtHandshakeMessage.h
	* src/BtKeepAliveMessage.cc
	* src/BtKeepAliveMessage.h
	* src/BtPieceMessage.cc
	* src/BtPieceMessage.h
	* src/BtPortMessage.cc
	* src/BtPortMessage.h
	* src/BtUnchokeMessage.h
	* src/DefaultBtMessageReceiver.cc
	* src/IndexBtMessage.cc
	* src/IndexBtMessage.h
	* src/PeerConnection.cc
	* src/PeerConnection.h
	* src/RangeBtMessage.cc
	* src/RangeBtMessage.h
	* src/SimpleBtMessage.cc
	* src/SimpleBtMessage.h
	* src/SocketBuffer.cc
	* src/SocketBuffer.h
	* src/ZeroBtMessage.cc
	* src/ZeroBtMessage.h
	* test/BtAllowedFastMessageTest.cc
	* test/BtBitfieldMessageTest.cc
	* test/BtCancelMessageTest.cc
	* test/BtChokeMessageTest.cc
	* test/BtExtendedMessageTest.cc
	* test/BtHandshakeMessageTest.cc
	* test/BtHaveAllMessageTest.cc
	* test/BtHaveMessageTest.cc
	* test/BtHaveNoneMessageTest.cc
	* test/BtInterestedMessageTest.cc
	* test/BtKeepAliveMessageTest.cc
	* test/BtNotInterestedMessageTest.cc
	* test/BtPieceMessageTest.cc
	* test/BtPortMessageTest.cc
	* test/BtRejectMessageTest.cc
	* test/BtRequestMessageTest.cc
	* test/BtSuggestPieceMessageTest.cc
	* test/BtUnchokeMessageTest.cc
2010-03-04 16:24:03 +00:00
Tatsuhiro Tsujikawa e976b23728 2009-10-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed Util.{cc,h} as util.{cc,h}
	* src/Util.cc
	* src/Util.h
	* src/util.cc
	* src/util.h
2009-10-22 15:35:33 +00:00
Tatsuhiro Tsujikawa 99654e4160 2009-09-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Move all functions in PeerMessageUtil to bittorrent_helper.
	* src/BtBitfieldMessage.cc
	* src/BtBitfieldMessageValidator.h
	* src/BtExtendedMessage.cc
	* src/BtHandshakeMessage.cc
	* src/BtHandshakeMessageValidator.h
	* src/BtPieceMessage.cc
	* src/BtPieceMessageValidator.h
	* src/BtPortMessage.cc
	* src/DHTFindNodeReplyMessage.cc
	* src/DHTGetPeersReplyMessage.cc
	* src/DHTMessageFactoryImpl.cc
	* src/DHTRoutingTableDeserializer.cc
	* src/DHTRoutingTableSerializer.cc
	* src/DHTTokenTracker.cc
	* src/DefaultBtMessageFactory.cc
	* src/IndexBtMessage.cc
	* src/IndexBtMessage.h
	* src/IndexBtMessageValidator.h
	* src/Makefile.am
	* src/PeerMessageUtil.cc: Removed.
	* src/PeerMessageUtil.h: Removed.
	* src/RangeBtMessage.cc
	* src/RangeBtMessage.h
	* src/RangeBtMessageValidator.h
	* src/UTPexExtensionMessage.cc
	* src/ZeroBtMessage.cc
	* src/ZeroBtMessage.h
	* src/bittorrent_helper.cc
	* src/bittorrent_helper.h
	* test/BittorrentHelperTest.cc
	* test/BtAllowedFastMessageTest.cc
	* test/BtBitfieldMessageTest.cc
	* test/BtCancelMessageTest.cc
	* test/BtChokeMessageTest.cc
	* test/BtExtendedMessageTest.cc
	* test/BtHandshakeMessageTest.cc
	* test/BtHaveAllMessageTest.cc
	* test/BtHaveMessageTest.cc
	* test/BtHaveNoneMessageTest.cc
	* test/BtInterestedMessageTest.cc
	* test/BtNotInterestedMessageTest.cc
	* test/BtPieceMessageTest.cc
	* test/BtPortMessageTest.cc
	* test/BtRejectMessageTest.cc
	* test/BtRequestMessageTest.cc
	* test/BtSuggestPieceMessageTest.cc
	* test/BtUnchokeMessageTest.cc
	* test/DHTFindNodeReplyMessageTest.cc
	* test/DHTGetPeersReplyMessageTest.cc
	* test/DHTMessageFactoryImplTest.cc
	* test/DHTRoutingTableDeserializerTest.cc
	* test/DHTRoutingTableSerializerTest.cc
	* test/DefaultBtMessageFactoryTest.cc
	* test/DefaultExtensionMessageFactoryTest.cc
	* test/Makefile.am
	* test/PeerListProcessorTest.cc
	* test/PeerMessageUtilTest.cc: Removed.
	* test/UTPexExtensionMessageTest.cc
2009-09-29 14:52:42 +00:00
Tatsuhiro Tsujikawa 7cf589e784 2008-11-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made BtRegistry non-static object. Now DownloadEngine has a
	reference to its object.
	* src/AbstractBtMessage.cc
	* src/ActivePeerConnectionCommand.cc
	* src/ActivePeerConnectionCommand.h
	* src/BtContextAwareCommand.cc
	* src/BtContextAwareCommand.h
	* src/BtExtendedMessage.cc
	* src/BtExtendedMessage.h
	* src/BtInterestedMessage.cc
	* src/BtInterestedMessage.h
	* src/BtNotInterestedMessage.cc
	* src/BtNotInterestedMessage.h
	* src/BtRegistry.cc
	* src/BtRegistry.h
	* src/BtSeederStateChoke.cc
	* src/BtSetup.cc
	* src/DHTGetPeersCommand.cc
	* src/DHTGetPeersCommand.h
	* src/DHTPeerAnnounceEntry.cc
	* src/DHTPeerAnnounceEntry.h
	* src/DHTPeerAnnounceStorage.cc
	* src/DHTPeerAnnounceStorage.h
	* src/DHTPeerLookupTask.cc
	* src/DHTPeerLookupTask.h
	* src/DHTSetup.cc
	* src/DHTSetup.h
	* src/DHTTaskFactory.h
	* src/DHTTaskFactoryImpl.cc
	* src/DHTTaskFactoryImpl.h
	* src/DefaultBtAnnounce.cc
	* src/DefaultBtInteractive.cc
	* src/DefaultBtInteractive.h
	* src/DefaultBtMessageDispatcher.cc
	* src/DefaultBtMessageDispatcher.h
	* src/DefaultBtMessageFactory.cc
	* src/DefaultBtMessageFactory.h
	* src/DefaultBtMessageReceiver.cc
	* src/DefaultBtProgressInfoFile.cc
	* src/DefaultBtProgressInfoFile.h
	* src/DefaultBtRequestFactory.cc
	* src/DefaultBtRequestFactory.h
	* src/DefaultExtensionMessageFactory.cc
	* src/DefaultExtensionMessageFactory.h
	* src/DefaultPeerStorage.cc
	* src/DefaultPeerStorage.h
	* src/DownloadEngine.cc
	* src/DownloadEngine.h
	* src/InitiatorMSEHandshakeCommand.cc
	* src/InitiatorMSEHandshakeCommand.h
	* src/MSEHandshake.cc
	* src/MSEHandshake.h
	* src/Makefile.am
	* src/Makefile.in
	* src/PeerChokeCommand.cc
	* src/PeerChokeCommand.h
	* src/PeerInitiateConnectionCommand.cc
	* src/PeerInitiateConnectionCommand.h
	* src/PeerInteractionCommand.cc
	* src/PeerInteractionCommand.h
	* src/PeerObject.h
	* src/PeerReceiveHandshakeCommand.cc
	* src/PeerReceiveHandshakeCommand.h
	* src/ReceiverMSEHandshakeCommand.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/RequestGroupMan.cc
	* src/RequestGroupMan.h
	* src/SeedCheckCommand.cc
	* src/SeedCheckCommand.h
	* src/ShareRatioSeedCriteria.h
	* src/SimpleBtMessage.cc
	* src/TrackerWatcherCommand.cc
	* src/TrackerWatcherCommand.h
	* src/UTPexExtensionMessage.cc
	* src/UTPexExtensionMessage.h
	* test/BtCancelMessageTest.cc
	* test/BtChokeMessageTest.cc
	* test/BtExtendedMessageTest.cc
	* test/BtInterestedMessageTest.cc
	* test/BtNotInterestedMessageTest.cc
	* test/BtPieceMessageTest.cc
	* test/BtPortMessageTest.cc
	* test/BtRegistryTest.cc
	* test/BtRejectMessageTest.cc
	* test/BtRequestMessageTest.cc
	* test/DHTPeerAnnounceEntryTest.cc
	* test/DHTPeerAnnounceStorageTest.cc
	* test/DefaultBtMessageDispatcherTest.cc
	* test/DefaultBtMessageFactoryTest.cc
	* test/DefaultBtProgressInfoFileTest.cc
	* test/DefaultBtRequestFactoryTest.cc
	* test/DefaultExtensionMessageFactoryTest.cc
	* test/MSEHandshakeTest.cc
	* test/MockDHTTaskFactory.h
	* test/ShareRatioSeedCriteriaTest.cc
	* test/UTPexExtensionMessageTest.cc
2008-11-03 06:49:02 +00:00
Tatsuhiro Tsujikawa 8a920ba5e3 2008-10-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Changed signature of DHTMessageFactory::createResponseMessage().
	Removed unused validateIDMatch.
	* src/DHTMessageFactory.h
	* src/DHTMessageFactoryImpl.cc
	* src/DHTMessageFactoryImpl.h
	* src/DHTMessageTracker.cc
	* test/DHTMessageFactoryImplTest.cc
	* test/MockDHTMessageFactory.h

	Dropped DHT message coming from same ID of localhost.
	* src/DHTMessageReceiver.cc

	Rejected adding node whose ID is the same as localhost's.
	* src/DHTRoutingTable.cc
	* test/BtPortMessageTest.cc
	* test/DHTRoutingTableTest.cc
2008-10-26 12:36:41 +00:00
Tatsuhiro Tsujikawa 3505201f33 2008-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten SharedHandle. Now copy constructor taking raw pointer 
has
	keyword explicit and SharedHandle's default constructor 
initializes
	its internal obj to null, old implementation initializes it 
using
	obj's default constructor.
	To assign null, write SharedHandle<T> x(...); x.reset();
	TODO: test/SharedHandleTest.cc needs more tests.
	* src/SharedHandle.h
2008-04-20 00:50:22 +00:00
Tatsuhiro Tsujikawa 032c7c2808 2008-03-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
type cleanup for allmost all remaining files.
2008-03-09 12:24:01 +00:00
Tatsuhiro Tsujikawa 5d6f1c046a 2008-02-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Bootstrap through node added by port message.
	Currently bootstrap is executed if the number of buckets in routing
	table is 1.
	* src/BtPortMessage.{h, cc}
	* src/DefaultBtMessageFactory.{h, cc}
	* src/PeerInteractionCommand.cc
	* test/BtPortMessageTest.cc
	* test/MockDHTTask.h
2008-02-10 15:57:00 +00:00
Tatsuhiro Tsujikawa 1b7c198289 2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Removed "using namespace std;" from all sources. Appended std:: 
prefix to c++
	standard classes.
	Included string.h where mem* function are used.
2008-02-08 15:53:45 +00:00
Tatsuhiro Tsujikawa 0f13363229 2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
	DHT is disabled by default. To enable it, give --enable-dht to 
aria2c.
	You may need to specify entry point to DHT network using
	--dht-entry-point. DHT uses UDP port to listen incoming message.
	Use --dht-listen-port to specify port number. Make sure that 
your
	firewall configuration can pass through UDP traffic to the port.
	The routing table is saved in $HOME/.aria2/dht.dat.
	* src/DHT*
	* src/BNode.{h, cc}
	* src/PeerInteractionCommand.cc: enable DHT functionality for a
	particular torrent.
	* src/Data.cc: Rewritten ctor.
	* src/OptionHandlerFactory.cc: Added --enable-dht, 
--dht-listen-port,
	--dht-entry-point.
	* src/DefaultBtInteractive.cc: Send port message if dht is 
enabled.
	* src/RequestGroup.cc: Initialize DHT functionality. When 
download
	ends, remove BtContext from DHTPeerAnnounceStorage.
	* src/BtPortMessage.{h, cc}: Rewritten.
	* src/message.h
	* src/OptionHandlerImpl.cc
	* src/option_processing.cc: Added --enable-dht, 
--dht-listen-port,
	--dht-entry-point.
	* src/Dictionary.{h, cc} (remove): New function.
	* src/prefs.h
	* src/DefaultBtMessageFactory.h
	* src/BtHandshakeMessage.cc
	* src/ActivePeerConnectionCommand.cc
	* src/SocketCore.{h, cc}: Added datagram socket support.
	* src/DefaultBtMessageFactory.cc
	* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
	Create DHT commands.
	* src/BtMessageFactory.h
	* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
Tatsuhiro Tsujikawa 729d566678 Fixed typo: threw -> thrown 2007-08-09 14:54:36 +00:00
Tatsuhiro Tsujikawa cd91e2ea4f 2007-01-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Xml2MetalinkProcessor.h
	(xpathExists): New function.
	* src/Xml2MetalinkProcessor.cc
	(xpathExists): New function.

	Not to send HEAD request if filename and size are available in 
Metalink
	file:
	* src/UrlRequestInfo.h
	(filename): New variable.
	(totalLength): New variable.
	(setTotalLength): New function.
	(setFilename): New function.
	* src/MetalinkRequestInfo.cc
	(execute): Set filename and size to UrlRequestInfo.
	* src/MetalinkEntry.cc
	(MetalinkEntry): Initialize size with 0.
	* src/UrlRequestInfo.cc
	(execute): Set filename and size to SegmentMan.
	
	Not to download rest of the files after selected files are 
downloaded
	in BitTorrent:
	* src/PieceStorage.h
	(allDownloadFinished): New function.
	* src/DefaultBtAnnounce.cc
	(isCompleteAnnounceReady): Use allDownloadFinished instead of
	downloadFinished.
	(getAnnounceUrl): Use allDownloadFinished instead of 
downloadFinished.
	* src/DefaultPieceStorage.cc
	(completePiece): Use allDownloadFinished instead of 
downloadFinished.
	Commented out the call to finishSelectiveDownloadingMode().
	(downloadFinished): Call isFilteredAllBitSet() instead of
	isAllBitSet().
	(allDownloadFinished): New function.
	* src/DefaultBtInteractive.cc
	(addBitfieldMessageToQueue): Call allDownloadFinished() instead 
of
	downloadFinished().
	(checkHave): Call allDownloadFinished() instead of 
downloadFinished().
	* src/TorrentDownloadEngine.cc
	(onEndOfRun): Call allDownloadFinished() instead of 
downloadFinished().
	* src/BitfieldMan.h
	(isFilteredAllBitSet): New function.
	* src/ShareRatioSeedCriteria.h
	(PieceStorage.h): New include.
	(pieceStorage): New variable.
	(evaluate):
	btContext->getTotalLength() -> 
pieceStorage->getCompletedLength()
	* src/BitfieldMan.cc
	(isFilteredAllBitSet): New function.
	(isAllBitSet): Filter is not took into account.
	
	Rename --force-truncate as --allow-overwrite:
	* src/TorrentRequestInfo.cc
	(execute): PREF_FORCE_TRUNCATE -> PREF_ALLOW_OVERWRITE
	* src/main.cc
	(showUsage): --force-truncate -> --allow-overwrite
	* src/message.h
	(EX_FILE_ALREADY_EXISTS): --force-truncate -> --allow-overwrite
	* src/prefs.h
	(PREF_FORCE_TRUNCATE): Removed.
	(PREF_ALLOW_OVERWRITE): New definition.
	* src/SegmentMan.cc
	(shouldCancelDownloadForSafety): --force-truncate -> 
--allow-overwrite
	
	* src/MetalinkRequestInfo.cc
	(execute): Queueing message are now logged in info level.

	* src/common.h
	(LONG_LONG_MAX): Removed.
	(LONG_LONG_MIN): Removed.
	* src/HttpResponseCommand.cc
	(handleDefaultEncoding): LONG_LONG_MAX -> INT64_MAX
	* src/FtpNegotiateCommand.cc
	(recvSize): LONG_LONG_MAX -> INT64_MAX
	
	* src/main.cc
	(showUsage): Added --check-integiry and 
--realtime-chunk-checksum
	command-line option.
	(main): Added --check-integiry and --realtime-chunk-checksum
	command-line option.
	--force-truncate -> --allow-overwrite
	Set initial value of --check-integrity option to false.
	Don't show usage when error occurs while persing command-line 
options.
	Removed deprecated --upload-limit option.
2007-01-28 14:18:35 +00:00
Tatsuhiro Tsujikawa a413cb50f7 2006-12-24 15:55:59 +00:00
Tatsuhiro Tsujikawa 9c3e8fbd9c 2006-12-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten a portion of bittorrent implementation:
	
	* src/BtMessageValidator.h: New class.
	* src/BtBitfieldMessageValidator.h: New class.
	* src/BtHandshakeMessageValidator.h: New class.
	* src/BtRequestMessageValidator.h: New class.
	* src/BtSuggestPieceMessageValidator.h: New class.
	* src/BtAllowedFastMessageValidator.h: New class.
	* src/BtRejectMessageValidator.h: New class.
	* src/BtCancelMessageValidator.h: New class.
	* src/BtPieceMessageValidator.h: New class.
	* src/BtHaveMessageValidator.h: New class.
	* src/BtEventListener.h: New class.
	* src/AbstractBtEventListener.h: New class.
	* src/BtEvent.h: New class.
	* src/BtChokingEvent.h: New class.
	* src/BtChokedEvent.h: New class.
	* src/BtCancelSendingPieceEvent.h: New class.
	* src/BtAbortOutstandingRequestEvent.h: New class.
	* src/Randomizer.h: New class.
	* src/SimpleRandomizer.h: New class.
	* src/BtMessage.h: New class.
	* src/AbstractBtMessage.h: New class.
	* src/SimpleBtMessage.h: New class.
	* src/BtHaveMessage.h: New class.
	* src/BtInterestedMessage.h: New class.
	* src/BtAllowedFastMessage.h: New class.
	* src/BtUnchokeMessage.h: New class.
	* src/BtCancelMessage.h: New class.
	* src/BtNotInterestedMessage.h: New class.
	* src/BtChokeMessage.h: New class.
	* src/BtHaveNoneMessage.h: New class.
	* src/BtHandshakeMessage.h: New class.
	* src/BtSuggestPieceMessage.h: New class.
	* src/BtHaveMessage.h: New class.
	* src/BtPieceMessage.h: New class.
	* src/BtHaveAllMessage.h: New class.
	* src/BtKeepAliveMessage.h: New class.
	* src/BtPortMessage.h: New class.
	* src/BtRejectMessage.h: New class.
	* src/BtBitfieldMessage.h: New class.
	* src/BtRequestMessage.h: New class.
	* src/DefaultBtRequestFactory.h: New class.
	* src/DefaultBtMessageReceiver.h: New class.
	* src/BtInteractive.h: New class.
	* src/BtMessageDispatcher.h: New class.
	* src/DefaultBtMessageDispatcher.h: New class.
	* src/DefaultBtInteractive.h: New class.
	* src/BitfieldManFactory.h: New class.
	* src/HandleRegistry.h: New class.
	* src/BtMessageFactory.h: New class.
	* src/BtMessageReceiver.h: New class.
	* src/DefaultBtMessageFactory.h: New class.
	* src/PeerObject.h: New class.
	* src/BtRequestFactory.h: New class.
2006-12-24 06:25:21 +00:00