Tatsuhiro Tsujikawa
8ba0d58ee1
Vectorized write for SocketBuffer to avoid small packet
2013-01-11 16:50:04 +09:00
Tatsuhiro Tsujikawa
215d1d3d0b
Made static create function of BtMessage subclass return raw pointer
2012-09-27 23:40:25 +09:00
Tatsuhiro Tsujikawa
c63af24c63
Made BtMessage's NAME const char[]
2012-09-25 23:28:24 +09:00
Tatsuhiro Tsujikawa
1372ac51ad
2010-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
...
Added .cc file for classes/structs that only provided by header
file. Defined non-POD classes' ctor, dtor in .cc file. Moved
implementation code in header file to .cc file for major
classes/strucsts.
2010-11-14 07:17:55 +00:00
Tatsuhiro Tsujikawa
2b458da480
2010-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
...
Made #include guard consistent for c++ header files.
2010-10-31 07:23:53 +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
812563bb6d
2010-06-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
...
Made protected member variable private. Added accessor funcs.
* src/AbstractBtMessage.cc
* src/AbstractBtMessage.h
* src/BtAllowedFastMessage.cc
* src/BtAllowedFastMessage.h
* src/BtBitfieldMessage.cc
* src/BtBitfieldMessage.h
* src/BtCancelMessage.cc
* src/BtCancelMessage.h
* src/BtChokeMessage.cc
* src/BtChokeMessage.h
* src/BtExtendedMessage.cc
* 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/BtNotInterestedMessage.cc
* src/BtNotInterestedMessage.h
* src/BtPieceMessage.cc
* src/BtPieceMessage.h
* src/BtPortMessage.cc
* src/BtPortMessage.h
* src/BtRejectMessage.cc
* src/BtRejectMessage.h
* src/BtRequestMessage.cc
* src/BtRequestMessage.h
* src/BtUnchokeMessage.cc
* src/BtUnchokeMessage.h
* src/SimpleBtMessage.cc
* src/SimpleBtMessage.h
2010-06-11 11:48:22 +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
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
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
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
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
cd9e35bc63
2007-01-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
* src/message.h: Added EX_INVALID_PAYLOAD_SIZE and
EX_INVALID_BT_MESSAGE_ID. Following source files affected.
* src/BtAllowedFastMessage.cc:
* src/BtBitfieldMessage.cc
* src/BtCancelMessage.cc
* src/BtChokeMessage.cc
* src/BtHaveAllMessage.cc
* src/BtHaveMessage.cc
* src/BtHaveNoneMessage.cc
* src/BtInterestedMessage.cc
* src/BtNotInterestedMessage.cc
* src/BtPieceMessage.cc
* src/BtPortMessage.cc
* src/BtRejectMessage.cc
* src/BtRequestMessage.cc
* src/BtSuggestPieceMessage.cc
* src/BtUnchokeMessage.cc
* src/message.h: Added EX_INVALID_CHUNK_CHECKSUM. Following
source
files are affected.
* src/ChunkChecksumValidator.cc
* src/SegmentMan.cc
2007-01-25 16:47:29 +00:00
Tatsuhiro Tsujikawa
d28e6aca15
2007-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
To add RecoverableException, FatalException:
* src/AbstractCommand.cc
(onAbort): Exception -> RecoverableException
* src/PeerAbstractCommand.h
(RecoverableException.h): New include.
(onAbort): Exception -> RecoverableException.
* src/PeerInteractionCommand.cc
(onAbort): Exception -> RecoverableException.
* src/PeerAbstractCommand.cc
(execute): Exception -> RecoverableException.
(onAbort): Exception -> RecoverableException.
* src/TorrentRequestInfo.cc
(execute): Exception -> RecoverableException.
* src/MetalinkRequestInfo.cc
(execute): Exception -> RecoverableException.
* src/MetaFileUtil.cc: RecoverableException.
* src/AbstractCommand.h
(onAbort): Exception -> RecoverableException.
* src/DlRetryEx.h: Exception -> RecoverableException.
* src/DlAbortEx.h: Exception -> RecoverableException.
* src/PeerListenCommand.cc: Exception -> RecoverableException.
* src/Util.cc: Exception -> RecoverableException.
* src/DefauldDiskWriter.cc: Exception -> RecoverableException.
* src/TrackerUpdateCommand.cc: Exception ->
RecoverableException.
* src/UrlRequestInfo.cc: Exception -> RecoverableException.
To make ID static const int
* src/BtInterestedMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtPieceMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtChokeMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtHaveAllMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtKeepAliveMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtHandshakeMessage.h
(ID): New variable.
(getId): Made non-const.
* src/BtSuggestPieceMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtPortMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/AbstractBtMessage.h
(id): Removed.
(AbstractBtMessage): Removed id.
(getId): Removed.
* src/BtHaveMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtAllowedFastMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtCancelMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtNotInterestedMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtChokeMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtRejectMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtBitfieldMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtUnchokeMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtRequestMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtHaveMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
To add --force-truncate command-line option and a check whether
the file already exists:
* src/DirectDiskAdaptor.h
(getFilePath): Made virtual public.
* src/MultiDiskAdaptor.h
(File.h): New include.
(DiskWriterEntry::fileEntry): Made private.
(DiskWriterEntry::fileExists): New function.
(DiskWriterEntry::getFileEntry): New function.
(fileExists): New function.
(getFilePath): New function.
* src/TorrentRequestInfo.cc
(FatalException.h): New include.
(message.h): New include.
(RecoverableException.h): New include.
(execute): Added a check whether file is already exists or not.
* src/DiskAdaptor.h
(fileExists): New function.
(getFilePath): New function.
* src/main.cc
(showUsage): Added an explanation of --force-truncate
command-line
option.
(main): Added --force-truncate command-line option.
* src/Exception.h
(setMsg): buf[256] -> buf[1024]
* src/CopyDiskWriter.h
(getFilePath): Made public virtual.
* src/MultiDiskAdaptor.cc: fileEntry -> getFileEntry()
(fileExists): New function.
* src/DownloadEngineFactory.cc
(newTorrentConsoleEngine): Don't open file here.
* src/message.h
(EX_FILE_ALREADY_EXISTS): New definition.
* src/prefs.h
(PREF_FOECE_TRUNCATE): New definition.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Added a check whether the file already
exists.
* src/SegmentMan.h
(fileExists): New function.
(shouldCancelDownloadForSafety): New function.
* src/FtpNegotiateCommand.cc
(recvSize): Added a check whether the file already exists.
* src/AbstractSingleDiskAdaptor.cc
(File.h): New include.
(fileExists): New function.
* src/AbstractSingleDiskAdaptor.h
(getFilePath): Removed.
(fileExists): New function.
* src/SegmentMan.cc
(fileExists): New function.
(shouldCancelDownloadForSafety): New function.
To fix regression bug in torrent downloading:
* src/DefaultBtRequestFactory.cc
(doChokedAction): New function.
* src/DefaultBtRequestFactory.h
(doChokedAction): New function.
* src/DefaultBtMessageDispatcher.cc
(doChokedAction): Do not delete request if its target is in
allowed
fast set.
* src/DefaultBtInteractive.cc
(doPostHandshakeProcessing): Added a call to
sendPendingMessage().
(sendKeepAlive): Send keep alive message even if the outgoing
message
queue is not empty.
(decideInterest): Simplified the code.
(fillPiece): Remove a call to dispatcher->doChokedAction()
because
it is already called when BtChokeMessage is received from a
peer.
* src/BtRequestFactory.h
(doChokedAction): New function.
To clean up code:
* src/PeerInteractionCommand.h
(executeInternal): Added virtual keyword explicitly.
(prepareForRetry): Added virtual keyword explicitly.
(prepareForNextPeer): Added virtual keyword explicitly.
(onAbort): Added virtual keyword explicitly.
* src/RequestSlot.cc
(isTimeout): Use Time::elapsed() instead of
differenceInMillis().
* src/BtPieceMessage.cc
(doReceivedAction): Added a debug log of piece's bitfield.
* src/Piece.h
(getBitfieldLength): New function.
* src/ByteArrayDiskWriter.cc
(clear): Added buf = 0 to avoid double free corruption.
* src/FileAllocator.cc
(allocate): Fixed an assignment of
fileAllocationMonitor->currentValue.
Added cp.reset().
* src/BitfieldMan.h
(operator=): Rewritten.
* src/BitfieldMan.cc
(BitfieldMan): Initialized bitfield, useBitfield.
* src/PeerConnection.cc
(receiveMessage): Added a call to socket->readable() after
getting
message length to avoid possible EOF.
* src/Util.cc
(torrentUrlencode): Fixed an encodeing bug. BUG#1629912
2007-01-11 16:32:31 +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