Commit Graph

20 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
162c138362 BtRegistry: Use std::unique_ptr for BtObject 2013-07-06 19:09:39 +09:00
Tatsuhiro Tsujikawa
bef6236da8 DownloadContext::attrs_ now holds std::unique_ptr
DownloadContext::getAttribute() returns a raw pointer.
2013-06-23 00:59:55 +09:00
Tatsuhiro Tsujikawa
07d270c87e Require -std=c++11 and use std::shared_ptr instead of SharedHandle 2013-06-22 01:10:38 +09:00
Tatsuhiro Tsujikawa
d68741697a Support UDP tracker
It shares UDP listening port with IPv4 DHT. At the moment, in order to
enable UDP tracker support, enable IPv4 DHT.
2013-02-25 00:56:49 +09:00
Tatsuhiro Tsujikawa
e2340efe27 Use std::vector instead of std::map for ContextAttribute objects
Now key for ContextAttribute object store is int instead of string.
2012-09-22 17:37:30 +09:00
Tatsuhiro Tsujikawa
9a51cc356b Changed interface of BtRegistry.
BtRegistry now uses SharedHandle<BtObject> instead of BtObject.
2011-11-01 23:13:13 +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
236e64cb25 2010-10-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use unnamed namespace instead of static keyword.
	* src/AbstractCommand.cc
	* src/AdaptiveURISelector.cc
	* src/Base64.cc
	* src/BitfieldMan.cc
	* src/BtDependency.cc
	* src/ConsoleStatCalc.cc
	* src/ContentTypeRequestGroupCriteria.cc
	* src/CookieStorage.cc
	* src/DHTMessageFactoryImpl.cc
	* src/DHTRoutingTableDeserializer.cc
	* src/DefaultBtAnnounce.cc
	* src/DefaultBtProgressInfoFile.cc
	* src/DefaultPeerStorage.cc
	* src/DefaultPieceStorage.cc
	* src/DownloadCommand.cc
	* src/DownloadEngine.cc
	* src/EpollEventPoll.cc
	* src/ExpatMetalinkProcessor.cc
	* src/ExpatXmlRpcRequestProcessor.cc
	* src/FileEntry.cc
	* src/HttpRequest.cc
	* src/HttpRequestCommand.cc
	* src/HttpResponseCommand.cc
	* src/KqueueEventPoll.cc
	* src/LongestSequencePieceSelector.cc
	* src/MetalinkParserStateV3Impl.cc
	* src/MetalinkParserStateV4Impl.cc
	* src/MultiDiskAdaptor.cc
	* src/MultiUrlRequestInfo.cc
	* src/OptionParser.cc
	* src/PeerSessionResource.cc
	* src/PortEventPoll.cc
	* src/Request.cc
	* src/RequestGroupMan.cc
	* src/SelectEventPoll.cc
	* src/SessionSerializer.cc
	* src/SimpleLogFormatter.cc
	* src/Sqlite3CookieParser.cc
	* src/TrackerWatcherCommand.cc
	* src/XML2SAXMetalinkProcessor.cc
	* src/Xml2XmlRpcRequestProcessor.cc
	* src/XmlRpcMethod.cc
	* src/XmlRpcMethodImpl.cc
	* src/XmlRpcResponse.cc
	* src/base32.cc
	* src/bencode2.cc
	* src/bittorrent_helper.cc
	* src/download_helper.cc
	* src/main.cc
	* src/messageDigest.cc
	* src/option_processing.cc
	* src/util.cc
	* test/AnnounceListTest.cc
	* test/BtRegistryTest.cc
	* test/DHTBucketTest.cc
	* test/DHTRoutingTableTest.cc
	* test/DefaultBtAnnounceTest.cc
	* test/FileEntryTest.cc
	* test/FtpConnectionTest.cc
	* test/MSEHandshakeTest.cc
	* test/MagnetTest.cc
	* test/XmlRpcMethodTest.cc
	* test/array_funTest.cc
2010-10-30 16:02:15 +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
8ba97188ce 2010-06-18 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Introduced ValueBase class, which is a replacement of BDE.  In
	this change ValueBase is used instead of BDE except DHT messages,
	UTMetadata messages and XML-RPC. They'll be replaced in the later
	commits. DownloadContext::_attrs is now ContextAttribute rather
	than BDE.
	* src/ActivePeerConnectionCommand.cc
	* src/AnnounceList.cc
	* src/AnnounceList.h
	* src/BtDependency.cc
	* src/BtRegistry.cc
	* src/BtSetup.cc
	* src/ConsoleStatCalc.cc
	* src/ContextAttribute.h
	* src/DefaultBtAnnounce.cc
	* src/DefaultBtInteractive.cc
	* src/DownloadContext.cc
	* src/DownloadContext.h
	* src/HandshakeExtensionMessage.cc
	* src/InitiateConnectionCommand.cc
	* src/LpdReceiveMessageCommand.cc
	* src/MSEHandshake.cc
	* src/Makefile.am
	* src/Makefile.in
	* src/PeerInteractionCommand.cc
	* src/PeerListProcessor.h
	* src/ProtocolDetector.cc
	* src/RequestGroup.cc
	* src/RequestGroupMan.cc
	* src/TorrentAttribute.h
	* src/TrackerWatcherCommand.cc
	* src/UTMetadataDataExtensionMessage.cc
	* src/UTMetadataPostDownloadHandler.cc
	* src/UTMetadataRequestExtensionMessage.cc
	* src/ValueBase.cc
	* src/ValueBase.h
	* src/XmlRpcMethodImpl.cc
	* src/XmlRpcMethodImpl.h
	* src/bencode2.cc
	* src/bencode2.h
	* src/bittorrent_helper.cc
	* src/bittorrent_helper.h
	* src/download_helper.cc
	* src/magnet.cc
	* src/magnet.h
	* test/AnnounceListTest.cc
	* test/Bencode2Test.cc
	* test/BencodeTest.cc
	* test/BittorrentHelperTest.cc
	* test/BtDependencyTest.cc
	* test/BtRegistryTest.cc
	* test/DefaultBtAnnounceTest.cc
	* test/DefaultBtProgressInfoFileTest.cc
	* test/HandshakeExtensionMessageTest.cc
	* test/MSEHandshakeTest.cc
	* test/MagnetTest.cc
	* test/Makefile.am
	* test/Makefile.in
	* test/RequestGroupManTest.cc
	* test/UTMetadataDataExtensionMessageTest.cc
	* test/UTMetadataPostDownloadHandlerTest.cc
	* test/UTMetadataRequestExtensionMessageTest.cc
	* test/ValueBaseTest.cc
	* test/XmlRpcMethodTest.cc
2010-06-18 14:47:09 +00:00
Tatsuhiro Tsujikawa
4db349c1f3 2010-01-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Untabify. Fixed one line in copyright which is longer than 80
	columns.
	* src
	* test
2010-01-05 16:01:46 +00:00
Tatsuhiro Tsujikawa
46d9f2de63 2009-11-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug which causes segmentation fault with tellWaiting
	XML-RPC method when BitTorrent download is waiting.  The key of
	BtRegistry is changed from info hash to GID, because it is
	registered per RequestGroup, not info hash.
	* src/BtRegistry.cc
	* src/BtRegistry.h
	* src/BtSetup.cc
	* src/ConsoleStatCalc.cc
	* src/InitiatorMSEHandshakeCommand.cc
	* src/PeerInitiateConnectionCommand.cc
	* src/PeerInteractionCommand.cc
	* src/PeerInteractionCommand.h
	* src/PeerReceiveHandshakeCommand.cc
	* src/RequestGroup.cc
	* src/XmlRpcMethodImpl.cc
	* test/BtRegistryTest.cc
	* test/XmlRpcMethodTest.cc
2009-11-25 15:49:20 +00:00
Tatsuhiro Tsujikawa
5699b67526 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
Tatsuhiro Tsujikawa
eaf5217de7 2009-06-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten BtRegistry
	* src/BtRegistry.cc
	* src/BtRegistry.h
	* src/BtSetup.cc
	* src/ConsoleStatCalc.cc
	* src/PeerInteractionCommand.cc
	* src/PeerReceiveHandshakeCommand.cc
	* src/ReceiverMSEHandshakeCommand.cc
	* src/RequestGroup.cc
	* src/XmlRpcMethodImpl.cc
	* test/BtRegistryTest.cc
2009-06-17 11:51:44 +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
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
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
048a2cf597 2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download.
	I've rewritten lots of files and now some headers have forward
	class declarations to reduce compile time.
	The implementation is extremely alpha stage, I recommend to use this
	for testing purpose only.
2007-10-11 16:58:24 +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
Tatsuhiro Tsujikawa
ec642ad294 2006-11-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To divide TorrentMan into 6 classes: BtContext, BtRuntime,
	PeerStorage, PieceStorage, BtAnnounce and BtProgressInfoFile

	* src/TrackerWatcherComand.h: Made subclass of 
BtContextAwareCommand.
	* src/SeedCheckCommand.cc: Use pieceStorage, btRuntime
	* src/PeerAbstractCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/PeerAbstractCommand.cc: Use btRuntime.
	* src/BtContextAwareCommand.h: New class.
	* src/FileEntry.h: Added accessor methods for following 
variables.
	(path): Made private.
	(length): Made private.
	(offset): Made private.
	(extracted): Made private.
	(requested): Made private.
	(FileEntries): New definition.
	(FileEntryHandle): New definition.
	* src/FileEntry.cc: New file.
	* src/HaveEraseCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/HaveEraseCommand.cc: Use btRuntime, pieceStorage.
	* src/PeerChokeCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/PeerChokeCommand.cc: Use btRuntime, peerStorage, 
pieceStorage.
	* src/PieceStorage.h: New file.
	* src/PeerInteractionCommand.h: Use btContext.
	* src/PeerInteractionCommand.cc: Use pieceStorage, peerStorage,
	btRuntime.
	* src/DefaultBtProgressInfoFile.h: New file.
	* src/DefaultBtProgressInfoFile.cc: New file.
	* src/File.cc
	(Util.h): New include.
	(mkdirs): New function.
	* src/MultiDiskAdaptor.h
	(mkdir): New function.
	* src/PeerListProcessor.h
	(Peers): Removed.
	* src/PeerInteraction.h
	(torrentMan): Removed.
	(btContext): New variable.
	(peerStorage): New variable.
	(pieceStorage): New variable.
	(btAnnounce): New variable.
	(getTorrentMan): Removed.
	(getBtContext): New function.
	* src/PeerInteraction.cc: Use btContext, peerStorage, 
pieceStorage,
	btAnnounce.
	* src/HandshakeMessage.h
	(TorrentMan.h): Removed.
	* src/HandshakeMessage.cc: Use btContext.
	* src/DefaultBtAnnounce.cc: New file.
	* src/MultiDiskWriter.cc: Use the accessor methods of FileEntry.
	* src/DefaultPieceStorage.cc: New file.
	* src/DefaultBtContext.h: New file.
	* src/TorrentRequestInfo.cc: Use btContext, pieceStorage.
	Use the accessor methods of FileEntry.
	* src/CookieBox.cc: Updated to use Util::slice().
	* src/PieceMessage.cc: Use btContext, pieceStorage.
	* src/common.h (SharedHandle.h): New include.
	* src/PeerMessage.cc (PeerMessage): Added btContext, 
peerStorage,
	pieceStorage.
	* src/TorrentAutoSaveCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/DiskAdaptor.h
	(topDir): Removed.
	(getFileEntryFromPath): Changed the return type to 
FileEntryHandle.
	(setTopDir): Removed.
	(getTopDir): Removed.
	* src/BtContext.h: New file.
	* src/DefaultPeerStorage.h: New file.
	* src/PieceMessage.h (TorrentMan.h): Removed.
	* src/RequestMessage.h (TorrentMan.h): Removed.
	* src/TorrentDownloadEngine.h
	(uploadLength): New variable.
	(btContext): New variable.
	(btRuntime): New variable.
	(pieceStorage): New variable.
	(peerStorage): New variable.
	(btAnnounce): New variable.
	(btProgressInfoFile): New variable.
	(torrentMan): Removed.
	(setBtContext): New function.
	* src/TorrentDownloadEngine.cc: Use BtContext, BtRuntime, 
pieceStorage,
	peerStorage, btAnnounce, btProgressInfoFile.
	* src/Piece.h
	(toString): New function.
	(Pieces): New type definition.
	* src/Peer.h
	(active): New variable.
	(Peer): Added active.
	(activate): Set active to true.
	(deactivate): Set active to false.
	(isActive): New function.
	(Peers): New type definition.
	* src/DirectDiskAdaptor.cc
	(getFilePath): Use the accessor methods of FileEntry.
	* src/TorrentConsoleDownloadEngine.h
	(afterEachIteration): New function.
	* src/TorrentConsoleDownloadEngine.cc
	(haltRequested): New variable.
	(sendStatistics): Use pieceStorage, btRuntime.
	(afterEachIteration): New function.
	* src/AnnounceList: AnnounceTier->AnnounceTierHandle.
	* src/Directry.h
	(Directory): New function.
	(DirectoryHandle): New type definition.
	* src/BtProgressInfoFile.h: New file.
	* src/RequestMessage.cc: Use pieceStorage.
	* src/BtRuntime.h: New file.
	* src/DefaultBtContext.cc: New file.
	* src/BitfieldMan.h
	(getCompletedLength): New function(private).
	(getCompletedLength): New function.
	(getFilteredCompletedLength): New function.
	* src/BitfieldMan.h
	(getCompletedLength): New function(private).
	(getCompletedLength): New function.
	(getFilteredCompletedLength): New function.
	* src/MultiDiskAdaptor.cc
	(mkdir): New function.
	(openFile): Call mkdir().
	(initAndOpenFile): Call mkdir().
	* src/CancelMessage.h
	(TorrentMan.h): Removed.
	* src/RejectMessage.h
	(TorrentMan.h): Removed.
	* src/DownloadEngineFactory.cc
	(DefaultPieceStorage.h): New include.
	(DefaultPeerStorage.h): New include.
	(DefaultBtAnnounce.h): New include.
	(DefaultBtProgressInfoFile.h): New include.
	(newTorrentConsoleEngine): Rewritten.
	* src/ShareRatioSeedCriteria.h
	(torrentMan): Removed.
	(btContext): New variable.
	(peerStorage): New variable.
	(btRuntime): New variable.
	(evaluate): Use btContext, btRuntime, peerStorage.
	* src/AnnounceTier.h: New file.
	* src/BtAnnounce.h: New file.
	* src/BtRegistry.h: New file.
	* src/PeerInitiateConnectionCommand.h: Added btContext.
	* src/PeerConnection.h (TorrentMan.h): Removed.
	* src/PeerMessageFactory.cc: Use btContext, pieceStorage.
	* src/Util.h
	(slice): Added an argument.
	* src/Util.cc
	(slice): Added an argument to control whether trim is made or 
not.
	* src/PeerStorage.h: New file.
	* src/BtRegistry.cc: New file.
	* src/TrackerUpdateCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/CopyDiskAdaptor.cc: Use the accessor methods of FileEntry.
	* src/MultiDiskWriter.h: FileEntry -> FileEntryHandle
	* src/PeerListenCommand.cc: Use btRuntime, peerStorage, 
btContext.
	* src/TorrentRequestInfo.h
	(e): Removed.
	(showFileEntry): Added an argument.
	(getDownloadEngine): Return 0.
	* src/DefaultBtAnnounce.h: New file.
	* src/TorrentAutoSaveCommand.cc: Use btRuntime, 
btProgressInfoFile.
	* src/TrackerWatcherComand.cc: Use btRuntime, btAnnounce,
	* src/PeerMessageFactory.h
	(btContext): New variable.
	(pieceStorage): New variable.
	* src/TrackerUpdateCommand.cc: Use btRuntime, peerStorage, 
btContext,
	btAnnounce.
	* src/DiskAdaptor.cc
	(DiskAdaptor): Removed topDir.
	(~DiskAdaptor): Removed topDir.
	* src/PeerListenCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/SeedCheckCommand.h: Made subclass of 
BtContextAwareCommand.
	* src/File.h (mkdirs): New function.
	* src/DefaultPeerStorage): New file.
	* src/DownloadEngineFactory.h
	(newTorrentConsoleEngine): Use btContext.
	* src/BtContextAwareCommand.cc: New file.
	* src/PeerInitiateConnectionCommand.cc: Use btRuntime, 
peerStorage.
	* src/PeerMessage.h
	(btContext): New variable.
	(peerStorage): New variable.
	(pieceStorage): New variable.
	(setBtContext): New function.
	* src/Directry.cc
	(Directory): New function.
	(createDir): Do nothing if name.size() == 0.
	* src/AnnounceList.h
	(AnnounceTier): Removed. 
	(AnnounceTiers): Removed.
	* src/DefaultPieceStorage.h: New file.
	* src/Piece.cc (toString): New function.
	
	To fix typo:
	
	* src/main.cc (showVersion): Fixed typo.

	To fix compile warning:
	
	* src/DelegatingPeerListProcessor.cc
	(canHandle): Added "return false".
2006-11-05 15:04:17 +00:00