To add Metalink location option:
* src/MetalinkRequestInfo.cc
(execute): Call MetalinkEntry::setLocationPreference()
* src/main.cc
(showUsage): Added the help message for --metalink-location
option.
(main): Added --metalink-location option.
* src/prefs.h
(PREF_METALINK_LOCATION): New definition.
* src/MetalinkEntry.cc
(AddLocationPreference): New function object.
(setLocationPreference): New function.
* src/Xml2MetalinkProcessor.cc
(getResource): Set location attribute to MetalinkResource
To show URLs to download
* src/UrlRequestInfo.h
(printUrls): New function.
To add multiple <file> Metalink support:
* src/MetalinkEntry.h
(MetalinkResources): Removed.
(setLocationPreference): New function.
(MetalinkEntryHandle): New type definition.
(MetalinkEntries): New type definition.
* src/Xml2MetalinkProcessor.h
(getEntry): MetalinkEntry* -> MetalinkEntryHandle
(getResource): MetalinkResource* -> MetalinkResourceHandle
(parseFile): Metalinker* -> MetalinkerHandle
* src/UrlRequestInfo.h
(execute): RequestInfo* -> RequestInfos
* src/MetalinkRequestInfo.cc
(AccumulateNonP2PUrl): MetalinkResource* ->
MetalinkResourceHandle
(FindBitTorrentUrl): MetalinkResource* -> MetalinkResourceHandle
(execute): RequestInfo* -> RequestInfos
Added multiple <file> support. Print filename when it is queued.
* src/MetalinkRequestInfo.h
(execute): RequestInfo* -> RequestInfos
(getDownloadEngine): Removed.
* src/RequestInfo.h
(RequestInfoHandle): New type definition.
(RequestInfos): New type definition.
(execute): RequestInfo* -> RequestInfos
(getDownloadEngine): Removed.
* src/MetalinkResource.h
(MetalinkResourceHandle): New type definition.
(MetalinkResources): New type definition.
* src/MetalinkEntry.cc
(~MetalinkEntry): Removed the deletion of the elements of
resources,
because the element is now of type MetalinkResourceHandle.
(PrefOrder): MetalinkResource* -> MetalinkResourceHandle
(Supported): MetalinkResource* -> MetalinkResourceHandle
(dropUnsupportedResource): Removed the deletion of the elements
of
resources because the element is now of type
MetalinkResourceHandle.
* src/Xml2MetalinkProcessor.cc
(parseFile): Metalinker* -> MetalinkerHandle
MetalinkEntry* -> MetalinkEntryHandle
Removed try-catch block.
(getEntry): MetalinkEntry* -> MetalinkEntryHandle
MetalinkResource* -> MetalinkResourceHandle
Removed try-catch block.
(getResource): MetalinkResource* -> MetalinkResourceHandle
Free result by using xmlXPathFreeObject()
* src/Metalinker.cc
(~Metalinker): Removed the deletion of entries.
MetalinkEntry* -> MetalinkEntryHandle
(queryEntry): Add multiple <file> Metalink support.
* src/Metalinker.h
(MetalinkEntries): Removed.
(queryEntry): MetalinkEntry* -> MetalinkEntries
* src/MetalinkProcessor.h
(parseFile): Metalinker* -> MetalinkerHandle
Bug fixes:
* src/PeerChokeCommand.cc
(execute): cat01->cat02
* src/DefaultPieceStorage.cc
(DefaultPieceStorage): Added diskAdaptor(0)
* src/TrackerWatcherComand.cc:
(execute): Use btAnnounce->noMoreAnnounce()
to determin whether the function returns true or not.
* src/TrackerUpdateCommand.cc:
(execute): Use btAnnounce->noMoreAnnounce()
to determin whether the function returns true or not.
* src/FtpConnection.cc
(bulkReceiveResponse): Throw DlRetryEx if EOF got.
This is the fix of the busy loop bug.
* src/DownloadCommand.cc
(DownloadCommand): Reuse PeerStat. segmentMan->getPeerStat()
returns
cached PeerStat.
The value of "name" entry in torrent file is now set by
*DiskAdaptor::setTopDir(...) methods.
* src/MultiDiskAdaptor.h
(topDir): New variable.
(setTopDir): New function.
(getTopDir): New function.
* src/MultiDiskAdaptor.cc
(getFilePath): Concat storDir, "/" and topDir.
(mkdir): Use getFilePath() to get the directory path for output.
* src/DefaultPieceStorage.cc
(initStorage): Set the value of "name" entry to
MultiDiskAdaptor,
CopyDiskAdaptor.
* src/CopyDiskAdaptor.h
(topDir): New variable.
(setTopDir): New function.
(getTopDir): New function.
* src/CopyDiskAdaptor.cc
(fixFilename): Updated.
Misc
* src/UrlRequestInfo.h
(e): Removed.
(UrlRequestInfo): Removed e.
(getDownloadEngine): Removed.
* src/UrlRequestInfo.cc
(handler): Rewritten.
(printUrls): New function.
(execute): Call printUrls().
* src/HandshakeMessage.cc
(check): peerinteraction->getBtContext() -> btContext
* src/PeerInteraction.h
(getBtContext): Removed.
* src/TorrentRequestInfo.h
(execute): RequestInfo* -> RequestInfos
(getDownloadEngine): Removed.
* src/TorrentRequestInfo.cc
(haltRequested): Removed.
(btHaltRequested): New variable.
(torrentHandler): haltRequested -> btHaltRequested
(execute): RequestInfo* -> RequestInfos
* src/TorrentConsoleDownloadEngine.cc
(afterEachIteration): haltRequested -> btHaltRequested.
* src/ConsoleDownloadEngine.h
(initStatistics): Added virtual.
(calculateStatistics): Added virtual.
(onEndOfRun): Added virtual.
(afterEachIteration): Added virtual.
* src/ConsoleDownloadEngine.cc
(haltRequested): New variable.
(afterEachIteration): New function.
* src/main.cc
(requestInfo): Removed.
* src/SegmentMan.cc
(findSlowerSegmentEntry): Refactored.
* 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 add asynchronous DNS support(libares):
* src/AbstractCommand.h
(setNameResolverCheck): New function.
(disableNameResolverCheck): New function
(resolveHostname): New function.
* src/AbstractCommand.cc
(setNameResolverCheck): New function.
(disableNameResolverCheck): New function
(resolveHostname): New function.
* src/FtpInitiateConnectionCommand.h
(nameResolver): New function.
* src/FtpInitiateConnectionCommand.cc
(Util.h): Included.
(FtpInitiateConnectionCommand): Call disableReadCheckSocket,
disableWriteCheckSocket.
(~FtpInitiateConnectionCommand): Call disableNameResolverCheck.
(executeInternal): Added async DNS support.
* src/HttpInitiateConnectionCommand.h
(nameResolver): New function.
* src/HttpInitiateConnectionCommand.cc
(DlRetryEx.h): Included.
(HttpInitiateConnectionCommand): Call disableReadCheckSocket,
disableWriteCheckSocket.
(~HttpInitiateConnectionCommand): Call disableNameResolverCheck.
(executeInternal): Added async DNS support.
* src/NameResolver.h: New class. Note: #include <ares.h> is
surrounded
by extern "C" declaration.
* src/NameResolver.cc: New class.
* src/Util.h:
(isNumberAndDotsNotation): New function
* src/Util.cc
(isNumberAndDotsNotation): New function.
* src/DownloadEngine.h
(NameResolver.h): Included.
(NameResolverEntry): New class.
(NameResolverEntries): New type definition.
(addNameResolverCheck): New function.
(deleteNameResolverCheck): New function.
* src/DownloadEngine.cc
(run): Initialize cp with 0.
(SetDescriptor::operator()): Added for NameResolverEntry.
(AccumulateActiveUuid::operator()): Added for NameResolverEntry.
(waitData): Check nameResolver entries.
(updateFdSet): Update fds in nameResolver entries.
(addNameResolverCheck): New function.
(deleteNameResolverCheck): new function.
* src/PeerInteractionCommand.cc
(executeInternal): Fixed wrong socket handling.
* src/main.cc
(main): Fixed the initial value of PREF_LOWEST_SPEED_LIMIT
option to 0.
* src/Util.cc
(fileChecksum): Removed the call to ctx.digestReset().
* src/FtpNegotiateCommand.cc
(recvGreeting): Call disableWriteCheckSocket just after
socket->setBlockingMode(). This avoids unnecessary CPU-hog loop.
2006-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/PeerChokeCommand.h
(PeerChokeCommand): Rearranged the arguments.
* src/PeerChokeCommand.cc
(PeerChokeCommand): Rearranged the arguments.
* src/MetalinkEntry.h
(Checksum.h): Included.
(md5): Removed.
(sha1): Removed.
(checksum): New variable.
(operator=): Updated.
(check): Removed.
* src/prefs.h
(PREF_LOWEST_SPEED_LIMIT): New definition.
(PREF_FOLLOW_TORRENT): New definition.
(PREF_SELECT_FILE): New definition.
(PREF_FOLLOW_METALINK): New definition.
* src/MetalinkResource.h
(TYPE_HTTPS): Added to enum TYPE.
* src/TorrentMan.cc
(~TorrentMan): Rewritten.
* src/MultiDiskWriter.cc
(MultiDiskAdaptor): Updated according to the changes in
MessageDigestContext.
(~MultiDiskAdaptor): Updated according to the changes in
MessageDigestContext.
(hashUpdate): Updated according to the changes in
MessageDigestContext.
(sha1Sum): Updated according to the changes in
MessageDigestContext.
* src/Util.h
(fileChecksum): Updated according to the changes in
MessageDigestContext.
* src/Util.cc
(sha1Sum): Updated according to the changes in
MessageDigestContext.
(fileChecksum): Updated according to the changes in
MessageDigestContext.
* src/messageDigest.h: Rewritten.
* src/MetalinkEntry.cc
(check): Removed.
(Supported): Updated.
(dropUnsupportedResource): Fixed a memory leak.
* src/ShaVisitor.cc
(ShaVisitor): Updated according to the changes in
MessageDigestContext.
(~ShaVisitor): Updated according to the changes in
MessageDigestContext.
(visit): Updated according to the changes in
MessageDigestContext.
* src/main.cc
(main): Rewritten the portion of download loop.
--lowest-speed-limit
command-line option added.
* src/DownloadEngine.h
(SocketEntry): New class.
(SocketEntries): New definition.
(PairFind): Removed.
(SockCmdMap): Removed.
* src/DownloadEngine.cc
(DownloadEngine): Rewritten.
(~DownloadEngine): Rewritten.
(run): Renamed activeCommandUuids as activeUuids.
(SetDescriptor): Rewritten.
(AccumulateActiveCommandUuid): Removed.
(AccumulateActiveUuid): New function object.
(waitData): Rewritten.
(updateFdSet): Rewritten.
(addSocket): Rewritten.
(deleteSocket): Rewritten.
(addSocketForReadCheck): Rewritten.
(deleteSocketForReadCheck): Rewritten.
(addSocketForWriteCheck): Rewritten.
(deleteSocketForWriteCheck): Rewritten.
* src/Xml2MetalinkProcessor.cc
(getEntry): Rewritten the portion of MetalinkEntry creation.
* src/DownloadCommand.cc
(executeInternal): Added the check routine for lowest speed
limit.
* src/AbstractDiskWriter.cc
(AbstractDiskWriter): Updated according to the changes in
MessageDigestContext.
(~AbstractDiskWriter): Updated according to the changes in
MessageDigestContext.
(sha1Sum): Updated according to the changes in
MessageDigestContext.
* src/RequestInfo.h: New class.
* src/UrlRequestInfo.h: New class.
* src/UrlRequestInfo.cc: New class.
* src/TorrentRequestInfo.h: New class.
* src/TorrentRequestInfo.cc: New class.
* src/MetalinkRequestInfo.h: New class.
* src/MetalinkRequestInfo.cc: New class.
* src/Checksum.h: New class.
* src/DownloadEngineFactory.h: New class.
* src/DownloadEngineFactory.cc: New class.
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.
* 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 --select-file command-line option:
* src/Util.cc
(unfoldRange): New function.
(getNum): New function.
(unfoldSubRange): New function
* src/main.cc
(showUsage): Added help message.
(main): Added --select-file command-line option.
2006-04-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To deploy upload rate based choking algorithm:
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Add peer to TorrentMan::activePeers to
track
peer currently used.
(decideChoking): Deleted the choke/unchoke decision algorithm
when
download completes. Simplified.
(receiveMessage): Updated.
* src/TorrentMan.h
(activePeers): New variable.
(addActivePeer): New function.
(getActivePeers): New function.
(deleteActivePeer): New function.
* src/TorrentMan.cc
(addPeer): deleteOldErrorPeers is moved to the begining of the
function
* src/PeerAbstractCommand.cc
(onAbort): Use peer->resetStatus().
* src/main.cc
(PeerChokeCommand.h): Included.
(main): Added the instance of ChokingCommand to the command
queue.
* src/Peer.h
(amChoking): Renamed from amChocking
(chokingRequired): New variable.
(optUnchoking): New variable.
(deltaUpload): New variable.
(deltaDownload): New variable.
(addDeltaUpload): New function.
(resetDeltaUpload): New function.
(addDeltaDownload): New function.
(resetDeltaDownload): New function.
(addPeerUpload): Added a call to addDeltaUpload.
(addPeerDownload): Added a call to addDeltaDownload.
* src/Peer.cc
(shouldBeChoking): Renamed from shouldChoke.
(resetStatus): New function.
* src/PeerChokeCommand.h: New class.
* src/PeerChokeCommand.cc: New class.
To add lazy upload speed limiter:
* src/TorrentConsoleDownloadEngine.h: Moved the variables for
statistics calculation to TorrentDownloadEngine.
* src/TorrentConsoleDownloadEngine.cc
(sendStatistics): Renamed from printStatistics.
(initStatistics): Removed. Moved to TorrentDownloadEngine.
(calculateSpeed): Removed. Moved to TorrentDownloadEngine.
(calculateStatistics): Removed. Moved to TorrentDownloadEngine.
* src/TorrentDownloadEngine.h: Added the variables for
statistics
calculation.
(sendStatistics): New function as pure virtual function.
(getUploadSpeed): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): New function.
(calculateSpeed): New function.
(calculateStatistics): New function.
* src/SendMessageQueue.h
(uploadLength): New variable.
(send): Added an argument.
(setUploadLimit): New function.
(getUploadLimit): New function.
* src/SendMessageQueue.cc
(send): Added upload speed limiter.
* src/prefs.h
(PREF_UPLOAD_LIMIT): New definition.
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Set upload speed limit to
sendMessageQueue.
* src/main.cc
(main): Added --upload-limit option
For bug fixes:
* src/main.cc
(showUsage): Corrected --listen-port help
Other changes:
* src/TorrentMan.cc
(getPeer): Return nullPeer if connection is grather than
MAX_PEER_UPDATE(15) in order to leave space for incoming peers.
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.
* ChunkedEncoding.cc: fixed memory leak.
* PeerInteractionCommand.cc: casted timeout value to long long
int.
* SleepCommand.cc: casted timeout value to long long int.
* Data.cc: fixed memory leak.
* Data.cc: fixed toLLInt().
* BitfieldMan.cc: fixed memory leak.
* TorrentMan.cc: initialized storeDir to ".".
* TorrentMan.cc: fixed memory leak.
* TorrentMan.cc: corrected file paths of splitted files.
* PeerAbstractCommand.cc: casted timeout to long long int.
* main.cc: added delete(req) and delete(te->diskWriter).
* RequestSlot.cc: casted timeout value to long long int.
* Request.cc: fixed memory leak.
* PendingMessage.cc: make HAVE messages sent only when peer does
not
have the piece.
* Peer.{h,cc}: added hasPiece(int index).
* 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