To reduce overhead to find commands whose socket is either
readable or writable in the download engine loop:
* src/Command.h, src/Command.cc
(STATUS): New enum.
(status): New variable.
(statusMatch): New function.
(setStatusActive): New function.
(setStatusInactive): New function.
* src/DownloadEngine.h, src/DownloadEngine.cc
(executeCommand): New function.
(run): Simplified.
(waitData): Call Command::setStatusActive() when command's
socket is
readable or writable.
To fix segfault in Metalink download:
* src/UrlRequestInfo.h
(filename): Removed.
(totalLength): Removed.
(setTotalLength): Removed.
(setFilename): Removed.
* src/MetalinkRequestInfo.cc
(execute): Do not set filename and totalLength to reqInfo.
Set chunk checksum to reqInfo if it is not null.
* src/HttpResponseCommand.cc
(executeInternal): Fixed filename in log.
(handleDefaultEncoding): Removed the call to initBitfield() and
markAllPiecesDone().
(handleOtherEncoding): Added HEAD method handling.
* src/FtpNegotiateCommand.cc
(executeInternal): Added SEQ_HEAD_OK handling.
(recvSize): In HEAD handling, set sequence to SEQ_HEAD_OK and
return false.
* src/FtpNegotiateCommand.h
(SEQ_HEAD_OK): New definition.
* src/SegmentMan.cc
(initBitfield): Delete bitfield.
(isChunkChecksumValidationReady): Fixed the condition.
* src/UrlRequestInfo.cc: Fixed so that Metalink and Torrent
download
works fine.
* 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.
Introduce new preference PREF_BT_TIMEOUT. This is the timeout
value
for BitTorrent download.
* src/PeerAbstractCommand.cc
(PeerAbstractCommand): PREF_TIMEOUT -> PREF_BT_TIMEOUT
* src/main.cc:
(timeoutSpecified): Removed.
(main): Set the initial value of PREF_BT_TIMEOUT to 180.
Removed timeoutSpecified. TODO: Add --bt-timeout command line
option.
* src/TorrentRequestInfo.cc
(timeoutSpecified): Removed.
(torrentHandler): Removed timeoutSpecified and the change of
timeout
value.
* src/prefs.h
(PREF_BT_TIMEOUT): New definition.
Delete unused variables.
* src/TorrentRequestInfo.cc
(requestInfo): Removed.
* src/AbstractCommand.cc
(execute): Check whether the download has finished before
checking
socket status.
Return true if peerStat->getStatus() == REQUEST_IDLE.
Do not exit even if no segment is available.
* src/prefs.h
(PREF_STARTUP_IDLE_TIME): New definition.
* src/PeerInteractionCommand.cc
(executeInternal): Removed max speed limit. Because it performs
bad.
(receiveMessages): Added max speed limit. This was better than
above,
but still a little bit to be desired. Sometimes the download
speed
became much faster than I specified.
* src/SpeedCalc.h
(start): New variable.
(accumulatedLength): New variable.
(getAvgSpeed): New function.
* src/SpeedCalc.cc
(reset): Added start, accumulatedLength.
(update): Added calculation of an average speed.
(getAvgSpeed): New function.
* src/DownloadCommand.h
(sw): Removed.
* src/main.cc
(main): Added PREF_STARTUP_IDLE_TIME.
* src/PeerStat.h
(STATUS): Added REQUEST_IDLE.
(getMaxSpeed): Renamed as getMaxDownloadSpeed().
(getAvgDownloadSpeed): New function
(requestIdle): New function.
* src/SegmentMan.h
(SegmentEntryHandle): New type definition.
(SegmentEntries): Now holds SegmentEntryHandle.
(findSlowerSegmentEntry): New funtion.
* src/SegmentMan.cc
(save): Updated according to the changes in SegmentEntries.
(read): Updated according to the changes in SegmentEntries.
(FindSegmentEntryByIndex): Updated according to the changes in
SegmentEntries.
(FindSegmentEntryByCuid): Updated according to the changes in
SegmentEntries.
(checkoutSegment): Updated according to the changes in
SegmentEntries.
(onNullBitfield): Updated according to the changes in
SegmentEntries.
Renamed uitr as itr.
(findSlowerSegmentEntry): New function.
(getSegment): Updated according to the changes in
SegmentEntries.
Added the feature that cancels the segment with slow server and
fast
one takes it over.
(cancelSegment): Updated according to the changes in
SegmentEntries.
(getDownloadLength): Updated according to the changes in
SegmentEntries.
(init): Assigned 0 to bitfield after deleting it.
* src/DownloadCommand.cc
(STARTUP_IDLE_TIME): Removed.
(executeInternal): Use PREF_STARTUP_IDLE_TIME.
* src/FeatureConfig.cc
(FEATURE_ASYNC_DNS): New definition.
(FeatureConfig): Added aysnc DNS entry.
To replace CommandUuid with Command* in SocketEntry and
NameResolverEntry:
* src/DownloadEngine.h
(CommandUuids): Removed.
(SocketEntry::commandUuid): Removed.
(SocketEntry::command): New variable.
(SocketEntry::SocketEntry): Updated.
(SocketEntry::operator==): Updated.
(NameResolverEntry::commandUuid): Removed.
(NameResolverEntry::command): New variable.
(NameResolverEntry::NameResolverEntry): Updated.
(NameResolverEntry::operator==): Updated.
(waitData): Changed the argument type.
(addSocketForReadCheck): Changed the argument type.
(deleteSocketForReadCheck): Changed the argument type.
(addSocketForWriteCheck): Changed the argument type.
(deleteSocketForWriteCheck): Changed the argument type.
(addNameResolverCheck): Changed the argument type.
(deleteNameResolverCheck): Changed the argument type.
* src/DownloadEngine.cc
(FindCommand): Removed.
(run): Removed activeUuid. Added activeCommands instead.
(AccumulateActiveUuid): Renamed as AccumulateActiveCommand.
(AccumulateActiveCommand): New function object.
(waitData): Use AccumulateActiveCommand.
(addSocketForReadCheck): Use Command instead of CommandUuid.
(deleteSocketForReadCheck): Use Command instead of CommandUuid.
(addSocketForWriteCheck): Use Command instead of CommandUuid.
(deleteSocketForWriteCheck): Use Command instead of CommandUuid.
(addNameResolverCheck): Use Command instead of CommandUuid.
(deleteNameResolverCheck): Use Command instead of CommandUuid.
* src/AbstractCommand.cc
(disableReadCheckSocket): Updated according to the changes in
DownloadEngine.
(setReadCheckSocket): Updated according to the changes in
DownloadEngine.
(disableWriteCheckSocket): Updated according to the changes in
DownloadEngine.
(setWriteCheckSocket): Updated according to the changes in
DownloadEngine.
(setNameResolverCheck): Updated according to the changes in
DownloadEngine.
(disableNameResolverCheck): Updated according to the changes in
DownloadEngine.
* src/AbstractCommand.cc
(disableReadCheckSocket): Updated according to the changes in
DownloadEngine.
(setReadCheckSocket): Updated according to the changes in
DownloadEngine.
(disableWriteCheckSocket): Updated according to the changes in
DownloadEngine.
(setWriteCheckSocket): Updated according to the changes in
DownloadEngine.
* release 0.7.1
To improve the conditional compilation:
* src/MultiDiskWriter.h:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/MultiDiskWriter.cc:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/Util.h:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
Added ENABLE_BITTORRENT around computeFastSet().
* src/Util.cc:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
Added ENABLE_BITTORRENT around computeFastSet().
* src/messageDigest.h:
Replaced ENABLE_BITTORRENT with ENABLE_SSL.
* src/ShaVisitor.h:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/ShaVisitor.cc:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/main.cc:
Added ENABLE_BITTORRENT around includes and blocks related to
BitTorrent.
* src/AbstractDiskWriter.h:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/AbstractDiskWriter.cc:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
To add command-line options for Metalink:
* src/main.cc:
Added metalink-version, metalink-language, metalink-os,
follow-metalink.
To use EXIT_SUCCESS and EXIT_FAILURE with exit():
* src/main.cc: Use these definition.
To fix the bug that causes same have message is sent many times
to
a single peer.
* src/Time.cc
(isNewer): Use Util::difftv().
To fix the bug that sends tracker requests without a sleep
interval
when the number of connections is less than 15.
* src/TrackerWatcherCommand.cc
(execute): Now the number of connections is not a factor to
decide
whether or not a tracker request should be sent or not.
* src/Time.h
(setTimeInSec): New function.
* src/Time.cc
(setTimeInSec): New function.
etc.
* src/ChokeMessage.cc
(receivedAction): Removed peer->snubbing = false
* src/PeerConnection.h
(receiveHandshake): Updated doc.
* src/TorrentMan.h
(getAdvertisedPieceIndexes): Updated the method signature.
* src/TorrentMan.cc
(getAdvertisedPieceIndexes): Updated the method signature.
* Release 0.5.2
To add Time class which represents a specific instant in time
and
its precision is microseconds. Time checking procedures were
rewritten
using this object.
* src/Time.h: New class.
* src/Time.cc: New class.
* src/AbstractCommand.h
(updateCheckPoint): Removed.
(isTimeoutDetected): Removed.
(checkPoint): Changed the type to Time.
(timeout): New variable.
(setTimeout): New function.
* src/AbstractCommand.cc
(AbstractCommand): Removed the initialization of checkPoint.
Added the initialization of timeout.
(updateCheckPoint): Removed.
(isTimeoutDetected): Removed.
(execute): Use checkPoint.reset() and checkPoint.elapsed().
* src/PeerChokeCommand.h
(checkPoint): Changed the type to Time.
* src/PeerChokeCommand.cc
(PeerChokeCommand): Removed the initialization of checkPoint.
(execute): Rewritten using Time object.
* src/TrackerWatcherCommand.h
(checkPoint): Changed the type to Time.
* src/TrackerWatcherCommand.cc
(TrackerWatcherCommand): Removed the initialization of
checkPoint.
(execute): Rewritten.
* src/ConsoleDownloadEngine.h
(cp): Changed the type to Time.
(startup): Changed the type to Time.
* src/ConsoleDownloadEngine.cc
(initStatistics): Use cp.reset(), startup.reset().
(calculateStatistics): Rewritten using Time object.
* src/PeerAbstractCommand.h
(updateCheckPoint): Removed.
(isTimeoutDetected): Removed.
(checkPoint): Changed the type to Time.
* src/PeerAbstractCommand.cc
(PeerAbstractCommand): Removed the initialization of checkPoint.
(updateCheckPoint): Removed.
(isTimeoutDetected): Removed.
(execute): Use checkPoint.reset() and checkPoint.elapsed().
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Removed the initializations of struct
timeval variables.
* src/PeerInteractionCommand.h
(keepAliveCheckPoint): Changed the type to Time.
(chokeCheckPoint): Changed the type to Time.
(freqCheckPoint): Changed the type to Time.
(haveCheckTime): Changed the type to Time.
* src/PeerInteractionCommand.cc
(executeInternal): Rewritten using Time object.
(detectMessageFlooding): Rewritten using Time object.
(checkLongTimePeerChoking): Rewritten using Time object.
(sendKeepAlive): Rewritten using Time object.
(checkHave): Rewritten using Time object.
* src/SleepCommand.h
(checkPoint): Changed the type to Time.
* src/SleepCommand.cc
(SleepCommand): Removed the initialization of checkPoint.
(execute): Rewritten using Time object.
* src/TorrentAutoSaveCommand.h
(checkPoint): Changed the type to Time.
* src/TorrentAutoSaveCommand.cc
(TorrentAutoSaveCommand): Removed the initialization of
checkPoint.
(execute): Rewritten.
* src/DownloadCommand.h
(sw): Changed the type to Time.
* src/DownloadCommand.cc
(DownloadCommand): Removed the initialization of sw.
(executeInternal): Rewritten.
* src/RequestSlot.h
(dispatchedTime): Changed the type to Time.
* src/RequestSlot.cc
(RequestSlot): Removed the call to setDispatchedTime().
(setDispatchedTime): Rewirtten.
(isTimeout): Rewritten.
(getLatencyInMillis): Rewritten.
* src/TorrentDownloadEngine.h
(cp): Changed the type to Time[2].
(startup): Changed the type to Time.
* src/TorrentDownloadEngine.cc
(initStatistics): Rewritten.
(calculateStatistics): Rewritten.
* src/DownloadEngine.cc
(run): Rewritten.
To detect all attempts to connect to the tracker are failed:
* src/AbstractCommand.cc
(execute): Increment e->segmentMan->errors if a command aborted.
* src/SegmentMan.h
(errors): New variable.
* src/SegmentMan.cc
(SegmentMan): Added the initialization of errors.
(init): Added the initialization of errors.
* src/TrackerWatcherCommand.cc
(execute): If e->segmentMan->errors > 0 then assume that the
tracker
request was failed.
To handle snubbed peers:
* src/PeerChokeCommand.cc
(optUnchokingPeer): Snubbed peers don't get unchoked.
(execute): Snubbed peers don't get unchoked.
* src/PeerInteraction.h
(REQUEST_TIME_OUT): Changed the value from 120 to 60.
* src/PeerInteraction.cc
(checkRequestSlot): A peer get marked as "snubbed" if it doesn't
send
back the requested 16k block in 60 seconds.
* src/PieceMessage.cc
(receivedAction): A peer's snubbed state is cleard if it sends
the requested 16k block in 60 seconds.
* src/Peer.h
(snubbing): New variable.
* src/Peer.cc
(resetStatus): Added snubbed = false.
To fix the bug that causes have message is not sent:
* src/PeerInteractionCommand.cc
(~PeerInteractionCommand): Removed
e->torrentMan->unadvertisePiece().
(FLOODING_CHECK_INTERVAL): New definition(temporal).
(detectMessageFlooding): Use FLOODING_CHECK_INTERVAL.
* src/TorrentMan.h
(HaveEntry): New class.
(advertisePiece): Rewritten.
(getAdvertisedPieceIndexes): Rewritten.
(Haves): Changed the type.
(getAdvertisedPieceIndexes): Added an argument.
Others:
* src/TorrentMan.h
(DEFAULT_ANNOUNCE_INTERVAL): Changed the value to 1800.
(DEFAULT_ANNOUNCE_MIN_INTERVAL): Changed the value to 1800.
* src/TorrentMan.cc
(getPeer): Don't check the number of connections here.
(setupInternal1): Changed peerId.
* src/PeerInteractionCommand.h
(KEEP_ALIVE_INTERVAL): New definition.
(sendKeepAlive): Use KEEP_ALIVE_INTERVAL.
* src/main.cc
(main): SA_ONESHOT was replaced with SA_RESETHAND.
* src/DownloadEngine.h: Removed unnecessary header includes.
* src/PeerAbstractCommand.h
(beforeSocketCheck): Removed.
* src/PeerAbstractCommand.cc
Modified in order to call executeInternal() even if socket check
and upload limit check fail.
* src/PeerInteractionCommand.h
(keepAlive): Removed.
(sendKeepAlive): New function.
(checkHave): New function.
(beforeSocketCheck): Removed.
* src/PeerInteractionCommand.cc
(executeInternal): Use peerInteraction->checkRequestSlot().
Added
calls to checkHave() and sendKeepAlive().
(keepAlive): Renamed to sendKeepAlive().
(sendKeepAlive): New function.
(beforeSocketCheck): Removed.
(checkHave): New function.
* src/BitfieldMan.cc
(getMissingIndex): Don't call getMissingIndexRandomly() if max
is 0.
(getMissingUnusedIndex): Don't call getMissingIndexRandomly() if
max is
0.
(getMissingIndex): Dont't call getMissingIndexRandomly() if max
is 0.
* src/TorrentMan.h
(UsedPieces): Removed.
(Pieces): New type definition.
* src/Piece.h: Updated doc.
* src/Peer.h
(totalLength): Removed.
* src/Peer.cc
(updateLatency): Fixed the latency calculation.
* src/TorrentMan.cc
(addPeer): Call deleteOldErrorPeers() only if peers.size() is
higher
than or equal to MAX_PEER_LIST_SIZE.
If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
then return false.
(deleteOldErrorPeers): Rewritten.
(deleteUsedPiece): Fixed the miss use of STL remove.
* src/PeerInteraction.h
(Pieces): Removed.
(deleteTimeoutRequestSlot): Removed.
(deleteCompletedRequestSlot): Removed.
(checkRequestSlot): New function.
* src/PeerInteraction.cc
(deleteTimeoutRequestSlot): Merged to checkRequestSlot().
(deleteCompletedRequestSlot): Merged to checkRequestSlot().
(checkRequestSlot): New function.
* src/DownloadEngine.cc
(run): Clear activeSockets before calling waitData().
(waitData): Removed a call to activeSockets.clear().
Each peer message has its own class.
* src/PendingMessages.h: Removed.
* src/PendingMessages.cc: Removed. The sending process was moved
to
each message class.
* src/RequestSlotMan.h: Removed.
* src/RequestSlotMan.cc: Removed. All functionarities were moved
to
SendMessageQueue.
* src/RequestMessage.h: New class.
* src/RequestMessage.cc: New class.
* src/CancelMessage.h: New class.
* src/CancelMessage.cc: New class.
* src/BitfieldMessage.h: New class.
* src/BitfieldMessage.cc: New class.
* src/ChokeMessage.h: New class.
* src/ChokeMessage.cc: New class.
* src/KeepAliveMessage.h: New class.
* src/KeepAliveMessage.cc: New class.
* src/PortMessage.h: New class.
* src/UnchokeMessage.h: New class.
* src/UnchokeMessage.cc: New class.
* src/PieceMessage.h: New class.
* src/PieceMessage.cc: New class.
* src/HaveMessage.h: New class.
* src/HaveMessage.cc: New class.
* src/BitfieldMessage.h: New class.
* src/BitfieldMessage.cc: New class.
* src/NotInterestedMessage.h: New class.
* src/NotInterestedMessage.cc: New class.
* src/InterestedMessage.h: New class.
* src/InterestedMessage.cc: New class.
* src/HandshakeMessage.h (sendMessageQueue): New variable.
(getSendMessageQueue): New function.
(setSendMessageQueue): New function.
* src/HandshakeMessage.cc: New class.
* src/PeerConnection.h (receiveMessage): Changed return value
and
arguments.
(receiveHandshake): Changed return value and arguments.
* src/PeerConnection.cc (receiveMessage): Do not create message
class
here.
(receiveHandshake): Do not create handshake class here.
* src/PeerInteractionCommand.h (peerConnection): Removed.
(piece): Removed.
(syncPiece): Removed.
(sendInterest): Removed.
(sendMessages): Removed.
(createRequestPendingMessage): Removed.
(checkPieceHash): Removed.
(erasePieceOnDisk): Removed.
(getNewPieceAndSendInterest): Removed.
(onGotNewPice): Removed.
(onGotWrongPiece): Removed.
* src/PeerInteractionCommand.cc (PeerInteractionCommand):
Removed peerConnection, piece.
(~PeerInteractionCommand): Removed peerConnection.
(executeInternal): Use sendMessageQueue instead of
peerConnection.
(syncPiece): Moved to SendMessageQueue.
(decideChoking): Removed PendingMessage.
(receiveMessage): Use sendMessageQueue instead of
peerConnection.
The action after receiving peer message was moved to each
message
class.
(onGotNewPice): Moved to SendMessageQueue.
(onGotWrongPiece): Moved to SendMessageQueue.
(getNewPieceAndSendInterest): Moved to SendMessageQueue.
(sendInterest): Moved to SendMessageQueue.
(createRequestPendingMessage): Removed.
(sendMessages): Moved to SendMessageQueue.
(onAbort): Use SendMessageQueue::abortPiece()
(keepAlive): Use sendMessageQueue instead of peerConnection.
(beforeSocketCheck): Use sendMessageQueue instead of
peerConnection.
(checkPieceHash): Moved to SendMessageQueue.
(erasePieceOnDisk): Moved to SendMessageQueue.
* src/PeerMessageUtil.h
(createBitfieldMessage): Removed.
(createHaveMessage): Changed return value and arguments.
(createBitfieldMessage): Changed return value and arguments.
(createRequestCancelMessage): Removed.
(createPieceMessage): Changed return value and arguments.
(getShortIntParam): New function.
(checkIndex): Changed arguments.
(checkBegin): Changed arguments.
(checkLength): Changed arguments.
(checkPieceOffset): Removed.
(checkRange): New function.
(checkBitfield): Changed arguments.
(createPeerMessage): Removed.
(checkIntegrity): Removed.
(createHandshakeMessage): Changed arguments.
(createChokeMessage): New function.
(createUnchokeMessage): New function.
(createInterestedMessage): New function.
(createNotInterestedMessage): New function.
(createRequestMessage): New function.
(createCancelMessage): New function.
(createPortMessage): New function.
* src/PeerMessageUtil.cc
(createBitfieldMessage): Removed.
(createHaveMessage): Changed return value and arguments.
(createBitfieldMessage): Changed return value and arguments.
(createRequestCancelMessage): Removed.
(createPieceMessage): Changed return value and arguments.
(getShortIntParam): New function.
(checkIndex): Changed arguments.
(checkBegin): Changed arguments.
(checkLength): Changed arguments.
(checkPieceOffset): Removed.
(checkRange): New function.
(checkBitfield): Changed arguments.
(createPeerMessage): Removed.
(checkIntegrity): Removed.
(createHandshakeMessage): Changed arguments.
(createChokeMessage): New function.
(createUnchokeMessage): New function.
(createInterestedMessage): New function.
(createNotInterestedMessage): New function.
(createRequestMessage): New function.
(createCancelMessage): New function.
(createPortMessage): New function.
* src/PeerMessage.h
(id): Removed.
(index): Removed.
(begin): Removed.
(length): Removed.
(bitfield): Removed.
(bitfieldLength): Removed.
(block): Removed.
(blockLength): Removed.
(inProgress): New variable.
(cuid): New variable.
(peer): New variable.
(sendMessageQueue): New variable.
(logger): New variable.
(setBitfield): Removed.
(getBitfield): Removed.
(setBlock): Removed.
(getBlock): Removed.
(getBitfieldLength): Removed.
(getBlockLength): Removed.
(isInProgress): New function.
(toString): Made pure virtual.
(check): New function.
(send): New function.
(receivedAction): New function.
(getId): Made pure virtual.
(setId): Removed.
(getIndex): Removed.
(setIndex): Removed.
(getBegin): Removed.
(setBegin): Removed.
(getLength): Removed.
(setLength): Removed.
(getCuid): New function.
(setCuid): New function.
(getPeer): New function.
(setPeer): New function.
(getSendMessageQueue): New function.
(setSendMessageQueue): New function.
(ID): Removed.
* src/PeerMessage.cc
(setBitfield): Removed.
(setBlock): Removed.
(toString): Removed.
* src/TorrentMan.h
(getPieceLength): New function.
(getPieceLength): New function.
* src/SendMessageQueue.h
(REQUEST_TIME_OUT): New definition.
(RequestSlots): New definition.
(MessageQueue): New definition.
(requestSlotMan): Removed.
(pendingMessages): Removed.
(requestSlots): New variable.
(messageQueue): New variable.
(torrentMan): New variable.
(peerConnection): New variable.
(peer): New variable.
(piece): New variable.
(getNewPieceAndSendInterest): New function.
(createPeerMessage): New function.
(createHandshakeMessage): New function.
(send): Made private.
(setPeerMessageCommonProperty): New function.
(deleteAllRequestSlot): New function.
(deleteRequestMessageInQueue): New function.
(cancelAllRequest): Made private.
(cancelAllRequest): Made private.
(countRequestSlot): Made private.
(addPendingMessage): Removed.
(deletePendingPieceMessage): Removed.
(deletePendingRequestMessage): Removed.
(addMessage): New function.
(deletePieceMessageInQueue): New function.
(deleteTimeoutRequestSlot): Changed argument.
(deleteCompletedRequestSlot): Changed argument.
(getCorrespoindingRequestSlot): Renamed to
getCorrespondingRequestSlot.
(getCorrespondingRequestSlot): New function.
(countPendingMessage): Removed.
(countMessageInQueue): New function.
(getTorrentMan): New function.
(getPeerConnection): New function.
(hasDownloadPiece): New function.
(getDownloadPiece): New function.
(setDownloadPiece): New function.
(syncPiece): New function.
(sendMessages): New function.
(sendNow): New function.
(trySendNow): New function.
(abortPiece): New function.
(sendHandshake): New function.
(receiveMessage): New function.
(receiveHandshake): New function.
(createRequestMessage): New function.
(createCancelMessage): New function.
(createPieceMessage): New function.
(createHaveMessage): New function.
(createChokeMessage): New function.
(createUnchokeMessage): New function.
(createInterestedMessage): New function.
(createNotInterestedMessage): New function.
(createBitfieldMessage): New function.
(createKeepAliveMessage): New function.
* src/SendMessageQueue.cc
(SendMessageQueue): Removed requestSlotMan.
Instantiated peerConnection here.
(~SendMessageQueue): Removed requestSlotMan.
Added deletion of peerConnection and the contents of
messageQueue.
(send): Updated according to the change of messageQueue.
(addPendingMessage): Renamed to addMessage.
(addMessage): New function.
(deletePendingPieceMessage): Renamed to
deletePieceMessageInQueue.
(deletePieceMessageInQueue): New function.
(deletePendingRequestMessage): Renamed to
deleteRequestMessageInQueue.
(deleteRequestMessageInQueue): New function.
(deleteRequestSlot): RequestSlotMan::deleteRequestSlot(...) was
moved
here.
(deleteTimeoutRequestSlot):
RequestSlotMan::deleteTimeoutRequestSlot
(...) was moved here.
(deleteAllRequestSlot):
RequestSlotMan::deleteAllRequestSlot(...) was
moved here.
(deleteCompletedRequestSlot):
RequestSlotMan::deleteCompletedRequestSlot(...) was moved here.
(getCorrespondingRequestSlot):
RequestSlotMan::getCorrespoindingRequestSlot(...) was moved
here.
And renamed to getCorrespondingRequestSlot, correcting a typo.
(countPendingMessage): Renamed to countMessageInQueue.
(countMessageInQueue): New function.
(countRequestSlot): RequestSlotMan::countRequestSlot() was moved
here.
(receiveHandshake): New function.
(createHandshakeMessage): New function.
(receiveMessage): New function.
(createPeerMessage): New function.
(syncPiece): New function.
(getNewPieceAndSendInterest): New function.
(sendMessages): New function.
(sendNow): New function.
(trySendNow): New function.
(sendHandshake): New function.
(abortPiece): New function.
(getDownloadPiece): New function.
(getPeerMessageCommonProperty): New function.
(createRequestMessage): New function.
(createCancelMessage): New function.
(createPieceMessage): New function.
(createHaveMessage): New function.
(createChokeMessage): New function.
(createUnchokeMessage): New function.
(createInterestedMessage): New function.
(createNotInterestedMessage): New function.
(createBitfieldMessage): New function.
(createKeepAliveMessage): New function.
To add simple Content-Disposition support:
* src/HttpResponseCommand.h (determinFilename): New function.
* src/HttpResponseCommand.cc (executeInternal):
Use determinFilename(headers) instead of req->getFile() when
comparing
filename.
(determinFilename): New function.
(handleDefaultEncoding): Use determinFilename(headers) instead
of
req->getFile().
(handleOtherEncoding): Use determinFilename(headers) instead of
req->getFile().
* src/Util.h (getContentDispositionFilename): New function.
* src/Util.cc (getContentDispositionFilename): New function.
* src/LogFactory.h (release): New function.
* src/LogFactory.cc (release): New function.
To fix a bug that causes out-of-bound exception when HTTP status
line is wrong:
* src/HttpConnection.cc (receiveResponse): Added a check for
header
size.
* src/common.h (Deleter): New class.
* src/SegmentMan.cc
(~SegmentMan): Added deletion of splitter and diskWriter.
* src/DownloadEngine.h
(Commands): Use deque.
(clearQueue): New function.
* src/DownloadEngine.cc
(~DownloadEngine): Added deletion of segmentMan.
(cleanQueue): New function.
* src/TorrentDownloadEngine.h
(TorrentDownloadEngine): The implementation was moved to
TorrentDownloadEngine.cc.
(~TorrentDownloadEngine): The implementation was moved to
TorrentDownloadEngine.cc.
* src/TorrentDownloadEngine.cc
(~TorrentDownloadEngine): Added deletion of torrentMan.
* src/main.cc
(clearRequest): Removed.
(handler): Added deletion of e.
(torrentHandler): Added deletion of te.
(main): Do not share splitter.
Use Deleter instead of clearRequest.
Deletion of classes were updated.
To add a readout of estimated remaining time to normal HTTP/FTP
downloads:
* src/ConsoleDownloadEngine.h (startup): New variable.
(startupLength): New variable.
(isStartupLengthSet): New variable.
(avgSpeed): New variable.
(eta): New variable.
* src/ConsoleDownloadEngine.cc (sendStatistics): Added a readout
of
estimated remaining time.
(initStatistics): Initialized newly added variables.
(calculateStatistics): Calculate average speed and estimated
remaining
time.
To decouple TorrentDownloadEngine from HttpResponseCommand:
* src/TrackerDownloadCommand.h: Removed.
* src/TrackerDownloadCommand.cc: Removed.
* src/TrackerInitCommand.h: Removed.
* src/TrackerInitCommand.cc: Removed.
* src/TrackerUpdateCommand.h: Removed.
* src/TrackerUpdateCommand.cc: Removed.
* src/TrackerWatcherCommand.cc (execute): The construction of
request
url written in TrackerInitCommand was moved here. Do not create
tracker request command if torretnMan->trackers != 0.
* src/CompactTrackerResponseProcessor.h: New class.
* src/CompactTrackerResponseProcessor.cc: New class.
* src/message.h (MSG_TRACKER_WARNING_MESSAGE): Updated.
* src/HttpResponseCommand.cc (createHttpDownloadCommand):
Decoupled TorrentDownloadEngine from this.
* src/SegmentMan.h (init): New function.
* src/SegmentMan.cc (init): New function.
* src/TorrentMan.h (responseProcessor): New variable.
(trackers): New variable.
(setTrackerResponseProcessor): New function.
(getTrackerResponseProcessor): New function.
(processTrackerResponse): New function.
* src/TorrentMan.cc (Constructor): Initialized new variable
trackers.
(processTrackerResponse): New function.
* src/main.cc (main): Use ByteArrayDiskWriter and
CompactTrackerResponseProcessor.
* src/TorrentDownloadEngine.cc (afterEachIteration): Call
torrentMan->
processTrackerResponse().
* src/TorrentConsoleDownloadEngine.cc (printStatistics): Updated
a
readout.
* src/TorrentDownloadEngine.cc (afterEachIteration): Added log
message
which indicates download has completed.
* src/AbstractDiskWriter.cc (Destructor): fd >= 0, not fd >0
(closeFile): fd >= 0, not fd > 0
* src/main.cc (main): Added short cut for show-files.
Added short cut for torrent-file.
Added new command-line option listen-port.
Updated i18n messages.
* TorrentDownloadEngine.cc: Prints "Download complete" message
instead of downloaded size and progress(%) after download
completes.
* PeerInteractionCommand.cc: After download completes, sends
unchoke
message to the peer if it is interested in what localhost has
downloaded.
* TorrentMan.cc: In single-file mode, copy temporary file to the
final
destination instead of just renaming it.
* TorrentMan.cc: Added deleteTempFile().
* PeerAbstractCommand.cc: do not stop execution after download
completes. This makes localhost a seeder.
* Util.{h,cc}: Added fileCopy().
* PeerListenCommand.cc: do not stop execution after download
completes.
This makes localhost a seeder.
* main.cc: Do not call TorrentMan::fixFilename() in
torrentHandler.
Added TorrentMan::deleteTempFile() to torrentHandler.
Initialized the variable dir as ".".
* TorrentMan.h: Changed DEFAULT_ANNOUNCE_INTERVAL to 120
seconds.
Deleted renameSingleFile().
Added copySingleFile(), deleteTempFile().
* DownloadEngine.h: Added virtual function afterEachIteration().
* TorrentDownloadEngine.cc: Move a call to
TorrentMan::fixFilename()
in onEndOfRun() to afterEachIteration().
In onEndOfRun(), changed if condition to check whether
filenameFixed is
true.
* Util.cc: Implemented fileCopy() using rangedFileCopy().
In rangedFileCopy(), added try-catch block to properly close
file
descriptors.
* TorrentDownloadEngine.cc: Added a member variable
filenameFixed.
Added afterEachIteration(), isFilenameFixed().
* Peer.cc: Changed choking strategy.
* PreAllocationDiskWriter.cc: Drop O_DIRECT flag.
* TrackerInitCommand.cc: Send completed event only once.
* DownloadEngine.cc: Added a call to afterEachIteration().
* TrackerUpdateCommand.cc: Do not stop execution after download
completes.
* TorrentMan.h: Defined MAX_PEER_UPDATE as 15. aria2 attempts to
connect the peers at most MAX_PEER_UPDATE when a peer list is
received from a tracker.
* TrackerUpdateCommand.cc: Implemented above mentioned behavior.
Decreased the number of failure peers to delete to 0(just
comment out
the line).
* Release 0.3.1
* ConsoleDownloadEngine.{h, cc}: Console output message(size,
speed)
is now generated by ConsoleDownloadEngine not by DownloadEngine.
* main.cc: Download complete/abort message is now generated by
main.
* Makefile.am (SUBDIRS): Add m4.
(ACLOCAL_AMFLAGS): New variable.
(EXTRA_DIST): New variable.
* configure.in (AC_CONFIG_FILES): Add po/Makefile.in,
* gettext: added gettext functionality