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
Extract the Peer class's member variables, which are only needed
after
PeerInteractionCommand, into PeerSessionResource class.
This class is instantiated in PeerInteractionCommand class's
ctor and
released in its dtor.
This will make Peer class lightweight and uses less memory for
peers
which are not connected and wait in the queue.
* src/PeerChokeCommand.cc
* src/PeerSessionResource.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerAbstractCommand.cc: Note: 0 is given to onAbort()
function.
* src/DefaultBtInteractive.cc
* src/BtPieceMessage.cc
* src/BtInterestedMessage.cc
* src/BtUnchokeMessage.cc
* src/DefaultPeerStorage.{h, cc}
* src/PeerInitiateConnectionCommand.cc
* src/ActivePeerConnectionCommand.cc
* src/BtNotInterestedMessage.cc
* src/DefaultBtMessageDispatcher.cc
* src/BtChokeMessage.cc
* src/BtRequestMessage.cc
* src/Peer.{h, cc}
* src/BtRegistry.h
* src/TrackerWatcherCommand.cc
* src/PeerReceiveHandshakeCommand.cc
* test/BtExtendedMessageTest.cc
* test/BtAllowedFastMessageTest.cc
* test/BtCancelMessageTest.cc
* test/DefaultPieceStorageTest.cc
* test/BtBitfieldMessageTest.cc
* test/BtHaveMessageTest.cc
* test/BtNotInterestedMessageTest.cc
* test/BtRequestMessageTest.cc
* test/PeerSessionResourceTest.cc
* test/DefaultBtMessageDispatcherTest.cc
* test/PeerTest.cc
* test/BtInterestedMessageTest.cc
* test/BtRejectMessageTest.cc
* test/BtChokeMessageTest.cc
* test/DefaultPeerStorageTest.cc
* test/BtHaveNoneMessageTest.cc
* test/BtHaveAllMessageTest.cc
* test/DefaultExtensionMessageFactoryTest.cc
* test/BtUnchokeMessageTest.cc
* test/DefaultBtMessageFactoryTest.cc
* test/HandshakeExtensionMessageTest.cc
* test/UTPexExtensionMessageTest.cc
* test/DefaultBtRequestFactoryTest.cc
* test/BtPieceMessageTest.cc
Removed typedef PeerStats.
* src/PeerStat.h
* src/SegmentMan.cc
Allocate bitfield in Peer when it is really used. More
specifically,
bitfield in Peer is allocated after the connection is
established and
deallocated when the connection is dropped.
Since 2 parameters(piece length and total length) was removed
from the
constructor of Peer class, many test classes were modified
accordingly.
See svn log for more detailed information.
* src/PeerInteractionCommand.cc
* src/CompactPeerListProcessor.cc
* src/Peer.cc
* src/DefaultPeerListProcessor.cc
* src/PeerListenCommand.cc
* src/PeerReceiveHandshakeCommand.cc
Fixed memory leak
* src/Piece.cc
* 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.
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.