Applied Ross's aria2-0.13.2+1-mingw-4.patch. In this commit,
only the
follow sources are applied.
* src/Platform.h: I removed HAVE_WINSOCK2_H directive from
Platform.h.
* src/Platform.cc: Moved common setup/teardown code to Platform
class.
I moved #endif // HAVE_WINSOCK2_H to the front of #include
"DlAbortEx.h"
I included locale.h from Platform.cc.
* src/main.cc: Moved common setup/teardown code to Platform
class.
* test/AllTest.cc: Use Platform class.
Set locale to C in AllTest.cc to prevent the messages to be
localized.
Applied Ross's aria2-0.13.2+1-mingw-3.patch.
* test/HttpHeaderTest.cc: Casted to off_t where it should.
* test/HttpRequestTest.cc: Casted to off_t where it should.
Create only requested files and files which shares a piece with
requested file in multi-torrent downloads. Directory structures
are
also created in the same rule.
MultiDiskAdaptor::fileExists() now uses FileEntry instead of
DiskWriterEntry as in the previous implementation.
* src/MultiDiskWriter.cc
* src/MultiFileAllocationIterator.cc
* src/MultiFileAllocationIterator.h
* test/MultiFileAllocationIteratorTest.cc
Always remove a peer from cache in
DefaultPeerStorage::returnPeer(),
to make room more fleshy, recently found peers.
Peer::_badConditionStartTime is not used anymore. Consider to
remove
it.
* src/DefaultPeerStorage.cc
* test/DefaultPeerStorageTest.cc
Calculate piece hash when data is arrived if the data is arrived
in
order. This removes additional read operation for hash
calculation.
If the data is arrived in out of order, the hash is calucated
when the
piece is completed. This is the same behavior as the old
implementation.
* src/BtPieceMessage.cc
* src/DefaultBtProgressInfoFile.cc
* src/DefaultPieceStorage.cc
* src/DownloadCommand.cc
* src/DownloadCommand.h
* src/DownloadEngine.cc
* src/GrowSegment.cc
* src/GrowSegment.h
* src/Piece.cc
* src/Piece.h
* src/PiecedSegment.cc
* src/PiecedSegment.h
* src/Segment.h
* test/PieceTest.cc
Reduced the usage of gettimeofday().
* src/DefaultBtMessageDispatcher.cc
(DefaultBtMessageDispatcher::checkRequestSlotAndDoNecessaryThing)
(class FindStaleRequestSlot, class ProcessStaleRequestSlot)
* src/RequestSlot.cc
* src/RequestSlot.h
(RequestSlot::isTimeout)
Made RequestSlot have a reference to Piece object to avoid find
Piece repeatedly.
* src/DefaultBtMessageDispatcher.cc
(class FindStaleRequestSlot, class ProcessStaleRequestSlot)
* src/RequestSlot.cc
* src/RequestSlot.h
(RequestSlot::getPiece)
* test/DefaultBtMessageDispatcherTest.cc
Fixed compile error when configured with --disable-metalink.
Also moved test/DownloadHandlerFactoryTest.cc to SRC in
Makefile.am.
* test/FeatureConfigTest.cc
* test/DownloadHandlerFactoryTest.cc
Put piece selection strategy algorithm to RarestPieceSelector
class,
Added a switch to choose whether randomized selection so that
unit
tests emit same results in, possibly, win32.
* src/DefaultPieceStorage.cc
* src/DefaultPieceStorage.h
* src/RarestPieceSelector.cc
* src/RarestPieceSelector.h
* test/DefaultPieceStorageTest.cc
* test/RarestPieceSelectorTest.cc
Fixed the bug that the control file(.aria2 file) is not renamed
according to tryAutoFileRenaming().
tryAutoFileRenaming() was rewritten so that if both renamed file
and
its control file exist, use them and continue download.
The old implementation didn't take into account of control
file's
existence, so basically you couldn't continue download of
renamed file.
* src/BtProgressInfoFile.h
* src/DefaultBtProgressInfoFile.cc
* src/DefaultBtProgressInfoFile.h
* src/NullProgressInfoFile.h
* src/RequestGroup.cc
* test/DefaultBtProgressInfoFileTest.cc
* test/MockBtProgressInfoFile.h
Reorganized version information so that it can be displayed in a
standard terminal screen without scrolling.
Removed http, ftp from Configuration section, because they are
always
enabled.
* src/FeatureConfig.cc
* src/FeatureConfig.h
* src/main.cc
* src/messageDigest.cc
* src/messageDigest.h
* src/version_usage.cc
* test/FeatureConfigTest.cc
Removed query part from filename in HTTP download. The query part means
the substring after "?" in URL. Firefox seems do the same thing.
A query part is sometimes very long and not suitable to filename,
so I think it is better to remove it from filename.
* src/HttpRequest.cc
* src/HttpRequest.h
* src/Request.cc
* src/Request.h
* test/HttpRequestTest.cc
* test/RequestTest.cc
Rewritten Exception class. Throw exception object, not its pointer and
catch by reference, so that remove problematic delete operator for
catched exception.
* src/Exception.cc
* src/Exception.h
* test/ExceptionTest.cc
* src/*: All files throwing/catching exception.
* test/*: All files throwing/catching exception.
Added StringFormat class, which internally calls vasprintf.
operator<< is defined for this class, so it can be used with iostream
classes nicely. SimpleLogger and following functions are rewritten
using StringFormat class.
Besides, now Logger class's methods are non-const, many classes
that has a const Logger* as a member variable are modified to remove
const qualifier from the variable declaration.
* src/HelpItemFactory.cc
* src/Request.cc
* src/SimpleLogger.cc
* src/StringFormat.cc
* src/StringFormat.h
* src/Util.cc
* src/option_processing.cc
* src/version_usage.cc
* test/StringFormatTest.cc
* src/*.h: The classes that has const Logger* as a member variable.
Added build-in "Accept-Feature" support. For now only "metalink" is
used in this header field.
This "metalink" value is removed from the list when connecting URLs
fed by metalink file to avoid loop in "transparent" metlaink.
* src/HttpRequest.cc
* src/HttpRequest.h: Renamed _userHeaders as _headers. Accept-Feature
header is also held in this variable. Also renamed setUserHeaders as
addHeader and it was rewritten to add header not just to clear the old
value.
* src/HttpRequestCommand.cc
* src/Metalink2RequestGroup.cc: Added the code to remove "metalink"
from "Accept-Feature" list.
* src/RequestGroup.cc: Added "metalink" to "Accept-Feature" by default.
* src/RequestGroup.h
* src/TaggedItem.cc: Moved Concat class to a2functional.h.
* src/a2functional.h: Included <string> because Concat class depends on
it.
* test/HttpRequestTest.cc
Now HTTP status and version are a member variable of HttpHeader.
HTTP status is processed as a string, not integer.
* src/AbstractProxyResponseCommand.cc
* src/HttpConnection.cc
* src/HttpHeader.cc
* src/HttpHeader.h
* src/HttpHeaderProcessor.cc
* src/HttpHeaderProcessor.h
* src/HttpResponse.cc
* src/HttpResponse.h
* test/HttpHeaderProcessorTest.cc
* test/HttpResponseTest.cc
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
Implemented auto protocol detection.
Now you can do:
aria2c -Z http://host/file file1.torrent file2.metalink
(Note: -Z option is required for auto protcol detection.)
Then aria2c downloads 3 files simultaneously:
1. http://host/file
2. file1.torrent <-- read local torrent file
3. file2.metalink <-- read local Metalink file.
Same thing goes with -i option. Assume your uris.txt contans:
http://host/file
file1.torrent
file2.metalink
Then you can do: aria2c -i uris.txt
(Note: -Z option is not needed if -i option is given.)
* src/main.cc
* src/ProtocolDetector.{cc, h}
* test/ProtocolDetectorTest.cc
Fixed high memory footprint when DHT is enabled.
This is not a memory leak, but DHTReplaceNodeTask is more frequently
queued than it is processed and the queue is getting longer. As a
consequence, momory usage is increased.
As for a fix, instead of issuing DHTReplaceNodeTask, I've implemented
replacement cache in DHTBucket which is described in Kademlia paper.
* src/DHTRoutingTable.cc (addNode): Removed the issuing of
DHTReplaceNodeTask.
* src/DHTBucket.{h, cc}
(cacheNode): New function.
(getCachedNodes): New function.
(dropNode): Push back cached node to _nodes.
* test/DHTBucketTest.cc
(testCacheNode): New test
(testDropNode): New test
* src/Util.{h, cc}
(parseUInt): New function.
(alphaToNum): Now returns unsigned int and 0 when overflow
detected.
The actual range is uint32_t.
* test/UtilTest.cc
* src/ParameterizedStringParser.cc:
Use Util::parseUInt() for loop variables.
* test/ParameterizedStringParserTest.cc
* src/PStringNumLoop.h: Make _startValue and _endValue unsigned
int.
Type clarification
* src/PeerSessionResource.{h, cc}
* src/DefaultPieceStorage.{h, cc}
* src/Peer.{h, cc}
* test/PeerSessionResourceTest.cc
Use div function
* src/BtPieceMessage.cc (erasePieceOnDisk)
Updated Makfefile.am to make 'make dist' work.
Now packaged filename is aria2c-VERSION.tar.bz2.
Added README, README.html, and aria2c.1.html to dist_doc_DATA.
Added LICENSE.OpenSSL to dist_noinst_DATA.
Large file support is now configured by configure script.
* configure.ac
Removed unsused source files
* src/
* test/
Removed PeerDecl.h and BtContextDecl.h. typedefs are removed to
Peer.h and BtContext.h respectively.
* src/Peer.h
* src/BtContext.h
Updated translations.
Added Polish, Thai, Indonesian, Norwegian Nynorsk, Hungarian
translations. Great thanks to all translators!;)
* po/*.{po, gmo}
Fixed the bug that DH key exchange sometimes fails due to bad
handling
of the number of bytes required for storing public key and
shared
secret.
* src/LibgcryptDHKeyExchange.h
* src/LibsslDHKeyExchange.h: Also added function name to
handleError.
* src/MSEHandshake.cc
* test/DHKeyExchangeTest.cc
Make room for future enchancements for IPv6 addresses.
Bump up version number of dht.dat file format to 2.
Not compatible with previous version.
* src/DHTRoutingTableSerializer.cc
* src/DHTRoutingTableDeserializer.cc
* test/DHTRoutingTableSerializerTest.cc
IPv6 support for SocketCore class.
TODO: In SocketCore::establishConnection(), this is insufficient
to
determin the failure of connect() here because the socket is
non-blocking state. The next addresses should be tried after
select().
TODO: NameResolver still uses c-ares(<= 1.4)
ares_gethostbyname().
If c-ares 1.5 or newer is installed, ares_getaddrinfo() should
be used
instead which address family independent.
TODO: DHTRoutingTable{Deserializer,Serializer} currently saves
peer
information in a compact peer format which is for IPv4 only.
Some BitTorrent functions in PeerMessageUtil still depends on
IPv4 but
this is a spec of BitTorrent protocol.
* src/SocketCore.{h, cc}
* src/PeerMessageUtil.cc
* test/SocketCoreTest.cc
* test/PeerMessageUtilTest.cc
* test/DHTConnectionImplTest.cc
Handle IPv4-mapped addresses.
* src/DHTNode.cc: Now identity is determined by node id.
* src/DHTMessageTrackerEntry.cc
Because now PeerMessageUtil::unpackcompact() could fail, the
caller
should handle it.
* src/DHTRoutingTableDeserializer.cc
* src/DHTMessageFactoryImpl.cc
Added the ability to load nodes from torrent file. These nodes are
added to the routing table when downloading that torrent.
* src/BtContext.h
* src/DefaultBtContext.{h, cc}
* src/DHTSetup.cc
* src/DHTEntryPointNameResolveCommand.{h, cc}: Now accepts list of
hostname and port pair, and resolves all of them.
* src/NameResolver.{h, cc}: Added reset().
* src/RequestGroup.cc
* test/DefaultBtContextTest.cc
* test/MockBtContext.h
Removed assert() from DefaultBtContext and throw exception instead.
* src/DefaultBtContext.cc
Bootstrap through node added by port message.
Currently bootstrap is executed if the number of buckets in routing
table is 1.
* src/BtPortMessage.{h, cc}
* src/DefaultBtMessageFactory.{h, cc}
* src/PeerInteractionCommand.cc
* test/BtPortMessageTest.cc
* test/MockDHTTask.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
Commented out ip address comparison because a host can have
multiple
ip addresses and it is hard to predict the hostname is resolved
into
which one.
* test/SocketCoreTest.cc (testWriteAndReadDatagram)
Fixed compiler warning about redefinition of SIZE_MAX.
Use common.h instead of config.h directly here.
* src/Platform.{h, cc}
The check of ENABLE_NLS is made in gettext.h, so it is not
required
here.
* common.h
2008-02-02 gettextize <bug-gnu-gettext@gnu.org>
Updated gettext related files.
* configure.ac (AC_CONFIG_FILES): Add intl/Makefile.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.17.
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
Added the message to inform users that other help categories are
available in -h option.
* src/version_usage.cc
* src/TagContainer.{h, cc}
* test/TagContainerTest.cc
* src/TaggedItem.{h, cc}
* test/TaggedItemTest.cc
* src/HelpItem.h
Rewritten get*Missing*Index functions. Now no need to allocate
memory
each time these functions are called.
* src/BitfieldMan.{h, cc}
* test/BitfieldManTest.cc
* src/array_fun.h
* test/array_funTest.cc
Now BitfieldMan::countBlock() returns BitfieldMan::blocks.
Added new BitfieldMan::countFilteredBlock() to get the number of
blocks
filtered. Removed unnecessary cast to int32_t.
* src/BitfieldMan.{h, cc}
Fixed the bug that DefaultPeerStorage::returnPeer() may delete wrong
peer if there are peers that have same ipaddr and port.
I've experiened segmentation fault and "pure virtual function was
called" error.
* src/Peer.h
* test/PeerTest.cc
* src/DefaultPeerStorage.cc
* test/DefaultPeerStorageTest.cc
Fixed the bug that always first found Segment is removed from
usedSegmentEntries. Removed unused functions.
* src/SegmentMan.{h, cc}
* test/SegmentManTest.cc
Fixed the bug that ServerHost is not removed.
* src/RequestGroup.cc
Move extension from BtRuntime to ExtensionMessageFactory, because
extension can be specified per peer, not per torrent.
* src/DefaultBtInteractive.cc
* src/BtRuntime.h
* src/ExtendedMessagingAware.h
* src/ExtensionMessageFactory.h
* src/DefaultExtensionMessageFactory.cc
* test/DefaultExtensionMessageFactoryTest.cc
Fixed segmentation fault when bad torrent metainfo is parsed.
Added dynamic_cast properly to detect the misconfiguration of
metainfo
and then throw exception or skip it.
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/AnnounceList.cc
* src/CompactPeerListProcessor.cc
* src/message.h
* src/DefaultBtAnnounce.{h, cc}
* test/DefaultBtAnnounceTest.cc
* src/BencodeVisitor.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
Removed incomingPeer. Set 0 to peer's port if it is not a listening
port.
* src/DefaultPeerStorage.{h, cc}
* test/DefaultPeerStorageTest.cc
* src/HandshakeExtensionMessage.cc
* test/HandshakeExtensionMessageTest.cc
* src/Peer.{h, cc}: Added ipaddr and port to identity comparison.
* src/PeerStorage.h
* test/MockPeerStorage.h
* src/PeerListenCommand.cc
Added uTorrent compatible Peer Exchange.
* src/BencodeVisitor.{h, cc}
* test/BencodeVisitorTest.cc
* src/BtConstants.h
* src/BtContext.h: Added 'private' flag.
* src/BtExtendedMessage.{h, cc}
* test/BtExtendedMessageTest.cc
* src/BtHandshakeMessage.{h, cc}: Set extended messaging bit in
reserved field.
* test/BtHandshakeMessageTest.cc
* src/BtMessageFactory.h
* src/BtRegistry.h
* src/BtRuntime.h: This class holds default extension message
IDs for
aria2. By default, aria2 uses ID 8 for ut_pex.
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.{h, cc}: This class holds
_utPexEnabled.
When it is true, aria2 enables ut_pex. This value is set by
PeerInteractionCommand.
* src/DefaultBtMessageFactory.{h, cc}
* test/DefaultBtMessageFactoryTest.cc
* src/DefaultBtMessageReceiver.cc: Moved the code of fast
extension
handling to DefaultBtInteractive class.
* src/DefaultExtensionMessageFactory.{h, cc}
* test/DefaultExtensionMessageFactoryTest.cc
* src/DefaultPeerStorage.cc: Returns false if a peer is already
in
the container(peers and incomingPeers. The equality is
determined by
Peer::id).
* test/DefaultPeerStorageTest.cc
* src/ExtensionMessage.h
* test/MockExtensionMessage.h
* src/ExtensionMessageFactory.h
* test/MockExtensionMessageFactory.h
* src/HandshakeExtensionMessage.{h, cc}
* test/HandshakeExtensionMessageTest.cc
* src/MetaEntry.h
* src/Peer.{h, cc}
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc: Evaluate the return value
of
addIncomingPeer.
* src/PeerMessageUtil.{h, cc}
* src/PeerObject.h
* src/UTPexExtensionMessage.{h, cc}
* test/UTPexExtensionMessageTest.cc
* src/message.h
* src/prefs.h
Fixed the bug that returns incomplete data when it contains null
character. A convenient constructor was also added.
* src/Data.{h, cc}
Rewritten.
* src/CompactPeerListProcessor.cc
Fixed typos.
* src/message.h
* src/MetaFileUtil.cc
Fixed the bug that prevents aria2 from loading cookie file when
expire
value is greater than 2^31-1. BUG#1851066
* src/CookieBoxFactory.cc
* test/CookieBoxFactoryTest.cc
Fixed possible memory leak when an exception is thrown.
* src/XML2SAXMetalinkProcessor.cc
Added Expat support. If both libxml2 and Expat are installed,
then
libxml2 is used by default.
MetalinkProcessorFactory chooses from XML2SAXMetalinkProcessor
and
ExpatMetalinkProcessor according to the configuration.
* src/ExpatMetalinkProcessor.{h, cc}
* src/main.cc: Removed libxml2 specific header and init/free
function.
* src/MetalinkProcessorFactory.{h, cc}
* src/MetalinkHelper.cc
* src/Metalinker.h: Removed unnecessary libxml2 header.
* src/MetalinkProcessor.h
* test/XML2SAXMetalinkProcessorTest.cc: Removed because
MetalinkProcessorTest is used instead.
* test/MetalinkProcessorTest.cc: Added. It is actually the same
with
XML2SAXMetalinkProcessor, replaced XML2SAXMetalinkProcessor with
MetalinkProcessorFactory::newInstance().
* m4/libexpat.m4
* configure.ac: Added configuration options for libexpat.
If several protocols are available for a mirror, aria2 now use
one of
them. --metalink-preferred-protocol option was added to specify
the
preference of protocol.
* src/AbstractCommand.cc
* src/OptionHandlerFactory.cc
* src/ServerHost.{h, cc}
* src/Metalink2RequestGroup.cc
* src/RequestGroup.{h, cc}
* test/RequestGroupTest.cc
* src/option_processing.cc
* src/prefs.h
* src/HttpResponseCommand.cc
* src/MetalinkResource.{h, cc}
* src/FtpNegotiationCommand.cc
* src/MetalinkEntry.{h, cc}
* src/MetalinkEntryTest.cc
Fixed the bug: only first announce URL is tried in AnnounceTier,
in stopped and completed event.
* src/AnnounceList.{h, cc}
* test/AnnounceListTest.cc
* src/DefaultBtAnnounce.cc
* test/DefaultBtAnnounceTest.cc
Sorted URLs.
* test/Metalink2RequestGroupTest.cc
Fixed the bug#1845750; CTRL+C does not stop torrent.
aria2 repeatedly sends stopped request when tracker returns error code.
* src/AnnounceList.cc
* test/AnnounceListTest.cc
* src/AnnounceTier.h
Added a message when ctrl-c is hit.
Now second ctrl-c is also handled in signal handler.
* src/RequestGroupMan.{h, cc}
* src/RequestGroup.{h, cc}
* src/MultiUrlRequestInfo.cc
* src/DownloadEngine.cc
* src/TrackerWatcherCommand.cc
Added XML2SAXMetalinkProcessor class, which is a lot faster than
the predecessor, Xml2MetalinkParser class.
I tested them against 94KB metalink file with 1234 chunk
checksums.
The new one parsed it in 22msec, while it took 6000msec with old
one.
* src/XML2SAXMetalinkProcessor.{h, cc}
* test/XML2SAXMetalinkProcessorTest.cc
* src/MetalinkParserController.{h, cc}
* test/MetalinkParserControllerTest.cc
* src/MetalinkParserState.h: Also added 16 subclasses.
* src/main.cc
* src/Metalink2RequestGroup.cc
* src/MetalinkHelper.cc
* src/MetalinkEntry.cc
* src/ChunkChecksum.h
Rewritten Base64 class for better performance.
* src/Base64.{h, cc}
* test/Base64Test.cc
* src/HttpRequest.cc
Added direct I/O support. The current implementation uses O_DIRECT,
which is not posix standard and is tested on linux 2.6.21.
Currently only file allocation uses direct I/O.
* src/SingleFileAllocationIterator.{h, cc}
* test/SingleFileAllocationIteratorTest.cc
* src/MultiFileAllocationIterator.{h, cc}
* test/MultiFileAllocationIteratorTest.cc
* src/BinaryStream.h
* src/DiskWriter.h
* src/AbstractDiskWriter.{h, cc}
* src/ByteArrayDiskWriter.h
* src/DiskAdaptor.h
* src/AbstractSingleDiskAdaptor.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/FileAllocationEntry.cc
* src/Util.{h, cc}
* src/OptionHandlerFactory.cc
* src/prefs.h
* src/version_usage.cc
* src/option_processing.cc
Moved FileAllocationMan::markCurrentFileAllocationEntryDone() to
handleException.
* src/MultiFileAllocationIterator.cc
Added EINTR handling
* src/SocketCore.cc
Set Content-Type to SingleFileDownloadContext when http response
is
received.
* src/HttpResponseCommand.cc
* src/HttpResponse.{h, cc}
* test/HttpResponseTest.cc
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
Trim announce URL
* src/DefaultBtContext.cc
* test/ShaVisitorTest.cc
Trim argument s. Give trimed s to exception constructor.
* src/Util.cc (parseInt)(parseLLInt)
* test/UtilTest.cc
Preallocate non-requested file which is adjacent forward to
requested
file('requested' files means the files given in --select-file
option)
if they share a same piece.
This fixes long pause in the file system which doesn't support
sparse
files like FAT32 while downloading.
* src/MultiFileAllocationIterator.{h, cc}
* test/MultiFileAllocationIteratorTest.cc
* src/FileEntry.{h, cc}
Removed unused _option.
* src/MultiDiskAdaptor.h
* test/MultiDiskAdaptorTest.cc
* src/DefaultPieceStorage.cc
Set the default value of --seed-ratio to 1.0.
If 0.0 is given, then seeding continues regardless of share
ratio.
* src/version_usage.cc
* src/option_processing.cc
* src/BtSetup.cc
* doc/aria2c.1.txt
* doc/aria2c.1
Fixed: Selective download is not working in BitTorrent
* src/RequestGroup.cc
Introduced Sequence class. Use this instead of
Util::unfoldRange()
* src/PieceStorage.h
* test/MockPieceStorage.h
* src/UnknownLengthPieceStorage.h
* src/DefaultPieceStorage.{h, cc}
* src/Metalink2RequestGroup.cc
* src/RequestGroup.cc
* src/Sequence.h
* test/SequenceTest.cc
* src/IntSequence.h
* src/message.h
* src/Util.{h, cc}
* test/UtilTest.cc
Added new function 'parse' to catch exception thrown by
subclass's
parseArg
* src/OptionHandler.h
* src/OptionParser.cc
* src/NameMatchOptionHandler.h
* src/OptionHandlerImpl.h
* test/OptionHandlerTest.cc
Added IntegerRangeOptionHandler. Used for --listen-port and
--select-file. Now --listen-port accepts range of port.
* src/OptionHandlerFactory.cc
* src/version_usage.cc
* src/OptionHandlerImpl.h
* src/option_processing.cc
* src/BtSetup.cc
* src/PeerListenCommand.{h, cc}
* doc/aria2c.1.txt
* doc/aria2c.1
Implemented operator< for Exception class to provide easy way to
print
exception stack trace.
* src/Exception.{h, cc}
* src/main.cc
* src/option_processing.cc
Recalculates download progress when loading a control file,
if the piece length of DownloadContext is different from the one
saved
in the control file. Currently in-flight pieces are ignored.
* src/DefaultBtProgressInfoFile.cc
* test/DefaultBtProgressInfoFileTest.cc
* src/Util.{h, cc}
* test/UtilTest.cc
Do not rotate tiers in announce-list.
* src/DefaultBtAnnounce.{h, cc}: Removed trackerNumTry.
AnnounceList::allTiersFailed() used instead to detect whether
all
tiers are tried and failed.
* test/DefaultBtAnnounceTest.cc
* src/AnnounceList.{h, cc}: If all tiers are tried and failed
then
allTiersFailed() returns true. To reset tier pointer, call
resetTier();
* test/AnnounceListTest.cc
* src/TrackerWatcherCommand.cc (execute): Removed DlAbortEx
catch
clause. Catch RecoverableException instead of DlRetryEx instead.
Implemented checksum validation feature(1 checksum for each
file)
The validation takes place after the download.
* src/PieceHashCheckIntegrityEntry.{h, cc}: New class.
* src/IteratableChecksumValidator.{h, cc}: Rewritten.
* src/CheckIntegrityCommand.cc: Changed log message.
* src/Metalink2RequestGroup.cc: Set checksum to
SingleFileDownloadContext.
* src/StreamCheckIntegrityEntry.{h, cc}: Now derived from
PieceHashCheckIntegrity class.
* src/BtCheckIntegrityEntry.{h, cc}: Now derived from
PieceHashCheckIntegrity class.
* src/ChecksumCheckIntegrityEntry.{h, cc}: New class.
* src/IteratableValidator.h: New class.
* src/message.h
* src/CheckIntegrityEntry.{h, cc}
* src/IteratableChunkChecksumValidator.{h, cc}
* src/SingleFileDownloadContext.h
* src/DownloadCommand.cc
--allow-overwrite=true is no longer needed to check file
integrity
before download in BitTorrent download.
* src/RequestGroup.cc (getInitialCommand)
Removed RequestGroup from queue when
RequestGroup::getInitialCommand()
throws exception.
* src/RequestGroupMan.cc (getInitialCommands)
urlencode the given url inside Request::parseUrl(...)
* src/Request.{h, cc}
* src/Util.{h, cc}
* test/RequestTest.cc
Removed #!metalink3! notation support because it is deleted from
the metalink specification.
* src/Request.{h, cc}
* test/RequestTest.cc
Reflect the download length of in-flight pieces.
It makes the download length readout more precise.
* src/DefaultPieceStorage.{h, cc}
* test/DefaultPieceStorageTest.cc
* src/a2functional.h
* test/a2functionalTest.cc
Lower CPU load when --max-download-limit is used.
There is up and down in speed indicator when enabling
http-pipelining but a download goes well. I think the problem is
that
because http-pipelining is enabled, DownloadCommand is created
for
each segment and in its constructor, PeerStat::downloadStart()
is
called. In PeerStat::downloadStart(), speed calculation object
is
reseted, which makes download speed zero.
* src/DownloadCommand.cc
Rewritten using accumulate.
* src/RequestGroupMan.cc (calculateStat)
Code clearnup.
* src/FtpNegotiationCommand.cc
* src/HttpResponseCommand.cc
Now a file is stored in the directory specified in .metalnk file
(file[@name]).
* src/Metalink2RequestGroup.cc
Create the directory structure when opening the file if it
doesn't
exist.
* src/AbstractDiskWriter.cc
* src/Util.{h, cc}
* src/File.h
* test/UtilTest.cc
Removed file name comparison
* src/Metalink2RequestGroup.cc
* src/HttpResponseCommand.cc
Rewritten using Util::mkdirs()
* src/FileEntry.cc (setupDir)
* test/FileEntryTest.cc
Updated doc
* src/SingleFileDownloadContext.h
Fixed: the listen port sent to the tracker is wrong. If aria2
fails
to open listen port, then remove the port number from the
tracker
request.
* src/DefaultBtAnnounce.cc
* test/DefaultBtAnnounceTest.cc
* test/MockPieceStorage.h
Inject randomizer to DefaultBtAnnounce and DefaultBtContext to
make
them more testable.
* src/DefaultBtAnnounce.{h, cc}
* src/DefaultBtContext.{h, cc}
* src/Util.{h, cc}
* test/DefaultBtAnnounceTest.cc
* test/DefaultBtContextTest.cc
* test/UtilTest.cc
Added 'B' to upload bytes readout.
* src/ConsoleStatCalc.cc
Now the listen port for BitTorrent download is opened when it is
needed.
* src/DownloadEngineFactory.cc
* src/BtSetup.{h, cc}
* src/PeerListenCommand.{h, cc}
Now an exception thrown while parsing tracker response is now
logged.
If DlAbortEx is catched, then btAnnounce->resetAnnounce()
immediately
called, which means no retry is made in this case, assuming a
tracker
has a problem.
* src/TrackerWatcherCommand.cc
Fixed: downloading a file whose length is unkown fails.
* src/DownloadCommand.cc
Simplified prepareForNextSegment()
* src/DownloadCommand.cc
Updated
* po/POTFILES.in
Re-implemented a file listing for Metalink, which was dropped
while
http/ftp/torrent integration was being implemented.
* src/MetalinkHelper.{h, cc}: New class.
* test/MetalinkHelperTest.cc
* src/main.cc
* src/Metalink2RequestGroup.cc
Added the ability to display the detailed torrent file
information.
Now -S option gives not only a file listing, but also total
download
length, info hash, announce URI, piece length, the number of
pieces,
and mode(single or multi-torrent).
* src/DefaultBtContext.{h, cc} (operator<<): New function.
* src/Util.cc (toStream): Show file length in a abbreviated
form(like
KiB)
* test/UtilTest.cc
* src/main.cc
Added the ability to recognize url-list in a torrent file.
The retrieved URLs are attached to the corresponding FileEntry.
* src/DefaultBtContext.{h, cc}
* src/FileEntry.{h, cc}
* test/DefaultBtContextTest.cc
* src/Piece.{h, cc}: Added SubPiece infrastructure to track down
the data smaller than block length.
A block length can be specified by constructor's argument.
* src/DefaultPieceStorage.{h, cc} (getMissingPiece):
Get a missing piece in the range of given FileEntry. This
function is
not used in the program yet.
* src/Util.h: Added some macros.
Implemented BitTorrent/http/ftp integrated download.
I've rewritten lots of files and now some headers have forward
class declarations to reduce compile time.
The implementation is extremely alpha stage, I recommend to use this
for testing purpose only.
Now *.aria2 contorol file is first saved to *.aria2__temp and if
it is successful, then renamed to *.aria2.
This prevents *.aria2 file from being truncated or corrupted
when
file system becomes out of space.
* src/DefaultBtProgressInfoFile.cc (save)
* src/SegmentMan.cc (save)
* test/DefaultBtProgressInfoFileTest.cc (testSave): Implemented.
Added the ability to disable segmented download in .metalink.
aria2 can now recognize 'maxconnections' attribute in
'resources' and
'url' tag.
* src/MetalinkEntry.{h, cc}
* src/RequestResource.{h, cc}
* src/MetalinkRequestInfo.cc
* src/Xml2MetalinkProcessor.cc
* test/Xml2MetalinkProcessorTest.cc
Added parameterized URI support.
* src/main.cc: -Z option added.
* src/OptionHandlerFactory.cc
* src/prefs.h: Added PREF_FORCE_SEQUENTIAL.
* src/PStringDatum.h: New class.
* src/PStringSegment.{h,cc}: New class.
* src/PStringNumLoop.h: New class.
* src/PStringSelect.h: New class.
* src/NumberDecorator.h: New class.
* src/FixedWidthNumberDecorator.h: New class.
* src/AlphaNumberDecorator.h: New class.
* src/PStringVisitor.h: New class.
* src/PStringBuildVisitor.{h,cc}: New class.
* src/ParameterizedStringParser.{h,cc}: New class.
* src/Util.{h,cc}
(isNumber): New function.
(isLowercase): New function.
(isUppercase): New function.
(alphaToNum): New function.
* test/ParameterizedStringParserTest.cc: New class.
* test/AlphaNumberDecoratorTest.cc: New class.
* test/PStringBuildVisitorTest.cc: New class.
* test/UtilTest.cc
(testIsNumber): New function.
(testIsLowercase): New function.
(testIsUppercase): New function.
(testAlphaToNum): New function.
Added '\n' after the error message
* src/RequestInfo.h (printDownloadAbortMessage)
Make a2netcompat.h include a2io.h to fix compilation error:
* src/a2netcompat.h
* src/SocketCore.cc: Removed include of a2io.h
* src/Util.cc: Removed include of a2io.h
Gather time related functions to a2time.h:
* src/a2time.h: New file.
* src/DefaultPeerStorage.cc
* src/SimpleLogger.cc
* src/Util.{h, cc}
* src/SimpleRandomizer.h
* src/TimeA2.{h,cc}
* src/DownloadCommand.cc
* src/main.cc
Removed #ifdef __MINGW32__ since gai_strerror is included in
a2netcompat.h:
* src/NameResolver.cc
Fixed compilation error without openssl:
* src/SocketCore.{h,cc}: Moved include of openssl/err.h to
SocketCore.h
Added default block to suppress compiler warnings:
* src/MetalinkRequestInfo.cc (AccumulateNonP2PUrl::operator())
2007-07-26 Ross Smith II <aria2spam at smithii dot com>
MinGW build enhancements. The following files are added:
* src/gai_strerror.{c,h}
* src/gettimeofday.{c,h}
Changes to support the above new files:
* configure.ac
* src/Makefile.am
* src/a2netcompat.h
* src/TimeA2.cc
* src/DefaultPeerStorage.cc
* src/NameResolver.cc: removed mingw_strerror() function.
* src/SocketCore.cc: removed mingw_strerror() function.
Miscellaneous MinGW build fixes.
* src/a2io.h: Use _lseeki64() instead of lseek()
* src/common.h
* src/DefaultFileAllocator.cc
* src/GlowFileAllocator.cc
* src/main.cc: Moved #include "prefs.h" to quiet compile error.
* src/NameResolver.cc
(callback): Changed int32_t to int.
(resolve): Changed int32_t to int.
* src/Platform.cc
* src/Platform.h
* test/MultiDiskWriterTest.cc
* test/PeerMessageUtilTest.cc
* src/localtime_r.c: Add DeleteCriticalSection() and at exit().
Other enhancements and fixes.
* src/HttpRequestCommand.cc
(executeInternal) Use non-blocking socket for HTTPS (MinGW
only).
* src/SocketCore.cc:
(error): New function to abstract errno/WSAGetLastError().
(errorMsg): New function to abstract errno/WSAGetLastError().
(initiateSecureConnection): Added more detailed error reporting.
* src/SocketCore.h: Added private variable blocking, to allow
proper handling of OpenSSL psuedo-errors.
* src/message.h
(EX_SSL_INIT_FAILURE)
(EX_SSL_IO_ERROR)
(EX_SSL_PROTOCOL_ERROR)
(EX_SSL_UNKNOWN_ERROR)
(EX_SSL_CONNECT_ERROR)
(EX_SOCKET_BLOCKING)
(EX_SOCKET_NONBLOCKING)
(EX_SOCKET_UNKNOWN_ERROR)
* src/Util.cc
(setGlobalSignalHandler): Renamed signal to sig as signal is a
reserved name.
(httpGMT): Fixed typo.
Merged Ross's win32 patch(manually)
In the course of merging, following files are added.
* src/strptime.{h,c}
* src/libgen.{h,c}
* src/inet_aton.{h,c}
* src/Platform.{h,cc}
* src/localtime_r.{h,c}
* src/getaddrinfo.{h,c}
I've gethered network related things, and put them to following
file:
* src/a2netcompat.h
Also io related things are put to following file:
* src/a2io.h
Changed %lld to %s because mingw32 doesn't recognize %lld.
* src/message.h
(MSG_ALLOCATION_COMPLETED)
(EX_TOO_LARGE_FILE)
(EX_SIZE_MISMATCH)
(EX_FILE_OFFSET_OUT_OF_RANGE)
(EX_INVALID_CHUNK_CHECKSUM)
(EX_INVALID_RANGE_HEADER)
* src/FileAllocationCommand.cc
* src/HttpResponse.cc
* src/RequestGroup.cc
* src/MultiDiskAdaptor.cc
* src/OptionHandlerImpl.h
* src/HttpResponseCommand.cc
* src/FtpNegotiateCommand.cc
* src/IteratableChecksumValidator.cc
* src/SegmentMan.cc
* src/ChunkChecksumValidator.cc
Added Randomizer::getRandomNumber(long int)
* src/Randomizer.h (getRandomNumber)
* src/SimpleRandomizer.h (getRandomNumber)
* src/BitfieldMan.cc (getMissingIndexRandomly): Use this new
function.
* src/Util.cc (randomAlpha): Use this new function.
Fixed the bug that prevents filename in content-disposition from
being retrieved when filename is not quoted.
* src/Util.cc (getContentDispositionFilename)
Fixed the bug that causes infinate loop and memory leak when
file open
operation failed.
* src/HttpResponseCommand.cc (handleDefaultEncoding)
Reads URIs from stdin when "-i -" is specified.
* src/UriFileListParser.h, src/UriFileListParser.cc: Removed.
* src/UriListParser.h, src/UriListParser.cc: New class.
* src/StreamUriListParser.h: New class.
* src/FileUriListParser.h: New class.
* src/main.cc (main): Use StreamUriListParser and
FileUriListParser
instead of UriFileListParser.
Create directory structure specified in metalink file.
* src/RequestGroup.h, src/RequestGroup.cc
(initAndOpenFile): Create a directory to store files if it does
not
exist.
(getDir): New function.
RequestGroup::getNextCommand() was renamed to
createNextCommand().
Added its overloaded method.
* src/RequestGroup.h
(_numConcurrentCommand): New variable.
(setNumConcurrentCommand): New function.
* src/RequestGroup.cc
Abort download if same file is being downloaded concurrently.
* src/RequestGroup.h, src/RequestGroupMan.cc
(isSameFileBeingDownloaded): New function.
* src/HttpResponseCommand.cc (executeInternal)
* src/FtpNegotiateCommand.cc (recvSize)
* src/message.h (EX_DUPLICATE_FILE_DOWNLOAD): New definition.
* main.cc: Added help message for -i option.
* src/PeerAbstractCommand.cc
(onAbort): Call PeerStorage::returnPeer()
* src/DefaultPeerStorage.h, src/DefaultPeerStorage.cc
(incomingPeers): New variable.
(addIncomingPeer): New function.
(returnPeer): New function.
(onErasingPeer): New function.
(addPeer): push_back -> push_front
(getActivePeers): Rewritten.
(calculateStat): Rewritten.
* src/PeerStorage.h
(TransferStat::copy): New function.
(TransferStat::TransferStat): New function.
(TransferStat::operator=): New function.
(addIncomingPeer): New function.
(returnPeer): New function.
* src/PeerListenCommand.cc
(execute): Use PeerStorage::addIncomingPeer() instead of
Peer::addPeer().
To add the command-line option which disables netrc support:
* src/OptionHandlerFactory.cc
(createOptionHandlers): Added PREF_NO_NETRC.
* src/main.cc: Added -n option.
* src/prefs.h (PREF_NO_NETRC): New definition.
* src/RequestFactory.cc: Do not use netrc in ftp if
PREF_NO_NETRC is
V_TRUE.
Note that netrc is not used in http, http proxy even if
PREF_NO_NETRC
is V_FALSE. This may get configurable in the future release.
To clear peer's error status by time basis:
* src/PeerAbstractCommand.cc
(onAbort): Call Peer::startBadCondition().
* src/Peer.h, src/Peer.cc
(error): Removed.
(_badConditionStartTime): New variable.
(_badConditionInterval): New variable. Initialized to 10
seconds.
(startBadCondition): New function.
(isGood): New function.
* src/DefaultPeerStorage.cc
(addPeer): Use Peer::isGood().
(FindFinePeer): Use Peer::isGood().
Always include port number in http request header:
* src/HttpRequest.cc (getHostText): Always include port number
in
http request header.
To the ability to read options from a config file:
* src/main.cc: Command-line parameter validation is delegated to
OptionHandler class.
* src/OptionHandlerFactory.h, src/OptionHandlerFactory.cc: New
class.
* src/Option.h, src/Option.cc (clear): New function.
* src/OptionParser.h, src/OptionParser.cc: New class.
* src/OptionHandler.h: New class.
* src/NameMatchOptionHandler.h: New class.
* src/OptionHandlerImpl.h: New classes.
* src/prefs.h: '_' -> '-'
(FTP_PASV_ENABLED): Renamed to FTP_PASV.
(FTP_PASV): New definition.
* src/Util.h, src/Util.cc (getRealSize): New function.
To disable netrc support if .netrc file does not have correct
permissions:
* src/File.h, src/File.cc (mode): New function.
To prevent confidential information to be logged:
* src/HttpConnection.h, src/HttpConnection.cc
(eraseConfidentialInfo): New function.
(sendRequest): Call eraseConfidentialInfo().
(sendProxyRequest): Call eraseConfidentialInfo().
* src/main.cc: Validate permissions of .netrc file.
To add --user-agent command-line option:
* src/main.cc: Added new command line option: --user-agent
* src/prefs.h (PREF_USER_AGENT): New definition.
* src/HttpRequestCommand.cc (executeInternal): Set user-agent
option
parameter to HttpRequest object.
Marged the patches from Dan Fandrich.
To add the ability to resume downloading a partially downloaded
file
which is downloaded from the beginning:
* src/FileAllocator.h: Made abstract class. New
DefaultFileAllocator
takes this role.
* src/main.cc: Added -c option.
* src/BitfieldMan.h, src/BitfieldMan.cc (setBitRange): New
function.
* src/DiskWriter.h (openExistingFile): Added totalLength
argument.
* src/prefs.h (PREF_CONTINUE): New definition.
* src/SegmentMan.h, src/SegmentMan.cc (markPieceDone): New
function.
* src/DefaultDiskWriter.cc
(createNewDiskWriter): Add GlowFileAllocator to the new object.
* src/AbstractDiskWriter.h
(glowFileAllocator): New variable.
* src/AbstractDiskWriter.cc
(openExistingFile): Now preallocate file space from the end of
the
existing file if totalLength argument is specified and grater
than 0.
* src/UrlRequestInfo.cc: If -c option is specified and the file
to download exists in local, continue the download of the file.
--allow-overwrite=true is assumed in this context.
* src/DefaultFileAllocator.h, src/DefaultFileAllocator.cc: New
class.
* src/GlowFileAllocator.h, src/GlowFileAllocator.cc: New class.
Throw exception if --check-integrity=true is specified but chunk
checksums are not provided:
* src/UrlRequestInfo.cc
* src/Request.h: Use AuthResolver to get authentication
information.
* src/main.cc: Made RequestFactory a singleton object. Netrc is
now
set to RequestFactory object.
* src/AuthConfigItem.h, src/AuthConfigItem.cc: Removed.
* src/AuthConfig.h, src/AuthConfig.cc: Rewritten.
* src/TrackerWatcherComand.cc: Use RequestFactorySingletonHolder
to
create Request object.
To integrate Netrc into exsiting classes:
* src/Request.h
(_userDefinedAuthConfig): New variable.
(findNetrcAuthenticator): New function.
(segment): Removed.
(setUserDefinedAuthConfig): New function.
(resolveHttpAuthConfigItem): New function.
(resolveFtpAuthConfigItem): New function.
(resolveHttpProxyAuthConfigItem): New function.
* src/HttpRequest.h
(authConfig): Removed.
(proxyAuthConfig): Removed.
(setAuthConfig): Removed.
(setProxyAuthConfig): Removed.
* src/UrlRequest.h
(getHeadResult): Added a parameter: authConfigHandle
* src/common.h
(SingletonHolder.h): New include.
* src/main.cc
(Netrc.h): New include.
(main): Removed initial values of PREF_FTP_USER,
PREF_FTP_PASSWD.
Added initial value of PREF_NETRC_PATH.
Added the initialization of netrc.
* src/AuthConfig.h: New class.
* src/prefs.h
(PREF_NETRC_PATH): New definition.
* src/HttpAuthConfig.h: Removed.
* src/Netrc.cc
(getRequiredNextToken): New function.
(skipMacdef): New function.
(parse): Rewritten.
* src/Netrc.h
(getRequiredNextToken): New function.
(skipMacdef): New function.
* src/Util.h, src/Util.cc
(getHomeDir): New function.
* src/TrackerWatcherComand.cc
(createRequestCommand): Use AuthConfig.
* src/FtpConnection.cc
(sendUser): Use Request::resolveFtpAuthConfigItem().
(sendPass): Use Request::resolveFtpAuthConfigItem().
* src/Request.cc
(findNetrcAuthenticator): New function.
(resolveHttpAuthConfigItem): New function.
(resolveFtpAuthConfigItem): New function.
(resolveHttpProxyAuthConfigItem): New function.
* src/UrlRequestInfo.cc: Use AuthConfig.
* src/HttpRequest.cc
(createRequest): Use authConfig.
(getProxyAuthString): Use authConfig.
(configure): Removed PREF_HTTP_USER, PREF_HTTP_PASSWD,
PREF_HTTP_PROXY_USER, PREF_HTTP_PROXY_PASSWD.
To handle Segment as SegmentHandle:
* src/AbstractCommand.cc (execute): Rewritten.
* src/SegmentMan.h: Segment -> SegmentHandle
Introducded HttpResponse class, HttpRequest class to improve
code
extensiveness and make it clear:
* src/HttpDownloadCommand.cc: transfer encoders are now managed
by
HttpResponse class.
* src/HttpRequest.h, src/HttpRequest.cc: New class.
* src/HttpResponse.h, src/HttpResponse.cc: New class.
* src/HttpConnection.cc: Contruction of http request were moved
to
HttpRequest class.
* src/HttpResponseCommand.h, src/HttpResponseCommand.cc:
Refactored.
* src/HttpRequestCommand.cc (executeInternal): Rewritten.
* src/HttpAuthConfig.h: New class.
* src/Range.h: New class.
To make FtpTunnel{Request, Response}Command and
HttpProxy{Request, Response}Command derived from
AbstractProxy{Request, Response}Command:
* src/FtpTunnelResponseCommand.h,
src/FtpTunnelResponseCommand.cc:
Derived from AbstractProxyRequestCommand class.
* src/FtpTunnelRequestCommand.h, src/FtpTunnelRequestCommand.cc:
Derived from AbstractProxyResponseCommand class.
* src/HttpProxyRequestCommand.h, src/HttpProxyRequestCommand.cc:
Derived from AbstractProxyRequestCommand class.
* src/HttpProxyResponseCommand.h,
src/HttpProxyResponseCommand.cc:
Derived from AbstractProxyResponseCommand class.
* src/AbstractProxyRequestCommand.h,
src/AbstractProxyRequestCommand.cc
: New class.
* src/AbstractProxyResponseCommand.h,
src/AbstractProxyResponseCommand.cc: New class.
To add netrc support:
* src/Netrc.h, src/Netrc.cc: New class.
* src/Util.h, src/Util.cc (split): New function.
* src/HttpHeader.cc (getRange): Fixed so that it inspects
"Content-Range" header instead of "Range" header.
* src/HttpHeader.h
(getStatus): Removed.
(setStatus): Removed.
* src/Segment.h
(getPositionToWrite): New function.
To fix the bug that causes crash on Max OS X:
* src/SimpleRandomizer.h
(getInstance): Create new instance if the static variable is
null.
* src/SimpleRandomizer.cc
(randomizer): Initialized to 0.
* src/BitfieldManFactory.h
(getNewFactory): Removed the call to setRandomizer().
To fix the miscalculation of the range of checksum:
* src/BitfieldMan.h
(isBitSetOffsetRange): New function.
* src/BitfieldMan.cc
(isBitSetOffsetRange): New function.
* src/SegmentMan.cc
(tryChunkChecksumValidation): Use
BitfieldMan::isBitSetOffsetRange().
Use bitfield->getBlockLength() instead of segment.segmentLength.
* 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.
To add chunk checksum validation:
* src/MetalinkEntry.h
(MetalinkChunkChecksum.h): New include.
(chunkChecksum): New variable.
* src/Request.h
(method): New variable.
(setMethod): New function.
(getMethod): New function.
(METHOD_GET): New static constant.
(METHOD_HEAD): New static constant.
* src/Xml2MetalinkProcessor.h
(getPieceHash): New function.
* src/PieceStorage.h
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/FileAllocator.h
(NullFileAllocationMonitor.h): New include.
(FileAllocator): Initialize fileAllocationMonitor with new
NullFileAllocationMonitor().
* src/MultiDiskAdaptor.h
(messageDigest.h): Remove include.
(ctx): Removed.
(hashUpdate): Added ctx.
(MultiDiskAdaptor): Removed ctx.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/UrlRequestInfo.h
(HeadResult): New class.
(digestAlgo): New variable.
(chunkChecksumLength): New variable.
(chunkChecksums): New variable.
(getHeadResult): New function.
(UrlRequestInfo): Added digestAlgo, chunkChecksumLength.
(setDigestAlgo): New function.
(setChunkChecksumLength): New function.
(setChunkChecksums): New function.
* src/DefaultPieceStorage.cc
(DiskAdaptorWriter.h): New include.
(ChunkChecksumValidator.h): New include.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/DefaultBtContext.h
(getPieceHashes): New function.
* src/TorrentRequestInfo.cc
(execute): Try to validate chunk checksum if file already exists
and
.aria2 file doesn't there and user allows aria2 to overwrite it.
* src/messageDigest.h
(~MessageDigestContext): Added digestFree().
* src/MetalinkRequestInfo.cc
(execute): Set digestAlgo, chunkChecksum, chunkChecksums to
reqInfo.
* src/DiskAdaptor.h
(messageDigest.h): New include.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/DownloadCommand.h
(PeerStat.h): New include.
(maxDownloadSpeedLimit): New variable.
(startupIdleTime): New variable.
(lowestDownloadSpeedLimit): New variable.
(peerStat): New variable.
(setMaxDownloadSpeedLimit): New function.
(setStartupIdleTime): New function.
(setLowestDownloadSPeedLimit): New function.
* src/BtContext.h
(getPieceHashes): New function.
* src/main.cc
(main): Set PREF_REALTIME_CHUNK_CHECKSUM and
PREF_CHECK_INTEGRITY
option to true for testing purpose.
* src/BtPieceMessage.cc
(checkPieceHash): Use messageDigest
* src/DownloadEngine.cc
(SetDescriptor): Removed.
(AccumulateActiveCommand): Removed.
(waitData): Rewritten.
(updateFdSet): Rewritten.
* src/MultiDiskAdaptor.cc
(hashUpdate): Added ctx.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/BitfieldMan.h
(isBitRangeSet): New function.
(unsetBitRange): New function.
* src/ByteArrayDiskWriter.h
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/ConsoleDownloadEngine.cc
(calculateStatistics): If nspeed < 0 then set nspeed to 0.
* src/DiskWriter.h
(messageDigest.h): New include.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/ChunkChecksumValidator.h: New class.
* src/DiskAdaptorWriter.h: New class.
* src/prefs.h
(PREF_REALTIME_CHUNK_CHECKSUM): New definition.
(PREF_CHECK_INTEGRITY): New definition.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Added method "HEAD" handling.
Removed the call to
e->segmentMan->shouldCancelDownloadForSafety().
(handleOtherEncoding):
Added the call to
e->segmentMan->shouldCancelDownloadForSafety().
(createHttpDownloadCommand): Set maxDownloadSpeedLimit,
startupIdleTime, lowestDownloadSpeedLimit to command.
* src/SegmentMan.h
(getSegmentEntryByIndex): New function.
(getSegmentEntryByCuid): New function.
(getSegmentEntryIteratorByCuid): New function.
(diskWriter): DiskWriter -> DiskWriterHandle
(pieceHashes): New variable.
(chunkHashLength): New variable.
(digestAlgo): New variable.
(FindPeerStat): Removed.
(getPeerStat): Rewritten.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
(tryChunkChecksumValidation): New function.
(isChunkChecksumValidationReady): New function.
* src/BitfieldMan.cc
(BitfieldMan): Initialized bitfieldLength, blocks to 0.
(BitfieldMan): Initialized blockLength, totalLength,
bitfieldLength,
blocks to 0.
(isBitRangeSet): New function.
(unsetBitRange): New function.
* src/FtpNegotiateCommand.cc
(executeInternal): Set maxDownloadSpeedLimit,
startupIdleTime, lowestDownloadSpeedLimit to command.
(recvSize): Added method "HEAD" handling.
Removed the call to
e->segmentMan->shouldCancelDownloadForSafety().
* src/AbstractSingleDiskAdaptor.cc
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/AbstractSingleDiskAdaptor.h
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/Util.h
(indexRange): New function.
* src/MetalinkEntry.cc
(MetalinkEntry): Initialized chunkChecksum to 0.
* src/ShaVisitor.cc
(~ShaVisitor): Removed the call to ctx.digestFree().
* src/SegmentMan.cc
(ChunkChecksumValidator.h): New include.
(SegmentMan): Initialized chunkHashLength to 0. Initialized
digestAlgo
to DIGEST_ALGO_SHA1.
(~SegmentMan): Removed diskWriter.
(FindSegmentEntryByIndex): Removed.
(FindSegmentEntryByCuid): Removed.
(checkoutSegment): Rewritten.
(findSlowerSegmentEntry): Rewritten.
(getSegment): Rewritten.
(updateSegment): Rewritten.
(completeSegment): Rewritten.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
(isChunkChecksumValidationReady): New function.
(tryChunkChecksumValidation): New function.
* src/Xml2MetalinkProcessor.cc
(getEntry): Get size and set it to entry.
Get chunk checksum and set it to entry.
(getPieceHash): New function.
* src/Util.cc
(sha1Sum): Removed ctx.digestFree()
(fileChecksum): Removed ctx.digestFree()
(indexRange): New function.
* src/Request.cc
(METHOD_GET): New variable.
(METHOD_HEAD): New variable.
(Request): Added method.
* src/UrlRequestInfo.cc
(FatalException.h): New include.
(message.h): New include.
(operator<<): Added operator<< for class HeadResult.
(getHeadResult): New function.
(execute): Get filename and size in separate download engine.
* src/ChunkChecksumValidator.cc: New class.
* src/DownloadCommand.cc:
(DownloadCommand): Added peerStat.
(executeInternal): Use maxDownloadSpeedLimit member instead of
getting
the value from Option.
The buffer size is now 16KB.
Use peerStat member instead of getting it from SegmentMan.
Use startupIdleTime member instead of gettingit from Option.
Added chunk checksum validation.
* src/AbstractDiskWriter.cc
(AbstractDiskWriter): Removed ctx.
(~AbstractDiskWriter): Removed ctx.digestFree()
(writeDataInternal): Returns the return value of write.
(readDataInternal): Returns the return value of read.
(sha1Sum): Renamed as messageDigest
(messageDigest): New function.
* src/AbstractDiwkWriter.h
(messageDigest.h): Removed include.
(ctx): Removed.
(sha1Sum): Renamed as messageDigest
(messageDigest): New function.
* src/DefaultPieceStorage.h
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/NullFileAllocationMonitor.h: New class.
To decrease CPU usage in bittorrent download, calculation
results in
BitfieldMan were cached and realtime fetching PeerObject was
removed
with WeakHandle introduced. Option values are set to the objects
by setter before download begins.
* src/DefaultBtRequestFactory.cc: Use messageFactory member.
* src/DefaultBtRequestFactory.h
(dispatcher): BtMessageDispatcherHandle ->
BtMessageDispatcherWeakHandle.
(messageFactory): New variable.
(setBtMessageDispatcher): BtMessageDispatcherHandle ->
BtMessageDispatcherWeakHandle.
(setBtMessageFactory): New function.
* src/DefaultBtMessageDispatcher.cc:
(sendMessages): Use maxUploadSpeedLimit instead of fetching the
value
from Option.
(checkRequestSlotAndDoNecessaryThing): Use requestTimeout
instead of
feating the value from Option.
Use messageFactory member.
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Added maxDownloadSpeedLimit.
Add reverse dependencies to factory object.
Set maxUploadSpeedLimit and requestTimeout and messageFactory to
dispatcher.
Set messageFactory to receiver.
Set keepAliveInterval and maxDownloadSpeedLimit and
messageFactory to
btInteractive.
Set receiver to peerObject.
Set maxDownloadSpeedLimit to this.
(executeInternal): Use maxDownloadSpeedLimit member.
* src/BtChokeMessage.cc
(doReceivedAction): Use dispatcher, requestFactory member.
(onSendComplete): Use dispatcher member.
* src/PeerInteractionCommand.h
(maxDownloadSpeedLimit): New variable.
* src/DefaultBtMessageReceiver.h
(peerConnection): PeerConnectionHandle ->
PeerConnectionWeakHandle
(dispatcher):
BtMessageDispatcherHandle -> BtMessageDispatcherWeakHandle
(messageFactory): New variable.
(setPeerConnection): PeerConnectionHandle ->
PeerConnectionWeakHandle
(getPeerConnection): PeerConnectionHandle ->
PeerConnectionWeakHandle
(setDispatcher):
BtMessageDispatcherHandle -> BtMessageDispatcherWeakHandle
(setBtMessageFactory): New function.
* src/DefaultBtInteractive.cc
(initiateHandshake): Use messageFactory member.
(addBitfieldMessageToQueue): Use messageFactory member.
(addAllowedFastMessageToQueue): Use messageFactory member.
(decideChoking): Use messageFactory member.
(checkHave): Use messageFactory member.
(sendKeepAlive): Use keepAliveInterval, messageFactory member.
(receiveMessages): Use maxDownloadSpeedLimit member.
(decideInterest): Use messageFactory member.
* src/BtRequestMessage.cc
(doReceivedAction): Use messageFactory, dispatcher member.
(onQueued): Use dispatcher member.
* src/BtPieceMessage.cc
(doReceivedAction): Use dispatcher member.
(send): Use peerConnection member.
(onWrongPiece): Use requestFactory member.
(handleChokingEvent): Use messageFactory, dispatcher member.
(handleCancelSendingPieceEvent): Use messageFactory, dispatcher
member.
* src/BtMessageDispatcher.h
(BtMessageDispatcherWeakHandle): New type definition.
* src/SimpleBtMessage.cc
(send): Use peerConnection member.
* src/BtRejectMessage.cc
(doReceivedAction): Use dispatcher member.
* src/DefaultBtMessageDispatcher.h
(Option.h): Removed include.
(messageFactory): New variable.
(option): Removed.
(maxUploadSpeedLimit): New variable.
(requestTimeout): New variable.
(DefaultBtMessageDispatcher): Removed option.
Added maxUploadSpeedLimit, requestTimeout.
(setOption): Removed.
(getOption): Removed.
(setMaxUploadSpeedLimit): New function.
(setRequestTimeout): New function.
(setBtMessageFactory): New function.
* src/DefaultBtInteractive.h
(btMessageReceiver):
BtMessageReceiverHandle -> BtMessageReceiverWeakHandle
(dispatcher):
BtMessageDispatcherHandle -> BtMessageReceiverWeakHandle
(btRequestFactory):
BtRequestFactoryHandle -> BtRequestFactoryWeakHandle
(peerConnection):
PeerConnectionHandle -> PeerConnectionWeakHandle
(messageFactory): New variable.
(option): Removed.
(keepAliveInterval): New variable.
(maxDownloadSpeedLimit): New variable.
(DefaultBtInteractive): Added keepAliveInterval,
maxDownloadSpeedLimit.
(setBtMessageReceiver):
BtMessageReceiverHandle -> BtMessageReceiverWeakHandle
(setDispatcher):
BtMessageDispatcherHandle -> BtMessageReceiverWeakHandle
(setBtRequestFactory):
BtRequestFactoryHandle -> BtRequestFactoryWeakHandle
(setPeerConnection):
PeerConnectionHandle -> PeerConnectionWeakHandle
(setOption): Removed.
(setKeepAliveInterval): New function.
(setMaxDownloadSpeedLimit): New function.
(setBtMessageFactory): New function.
* src/BitfieldMan.h
(cachedNumMissingBlock): New variable.
(cachedNumFilteredBlock): New variable.
(cachedCompletedLength): New variable.
(cachedFilteredComletedLength): New variable.
(cachedFilteredTotalLength): New variable.
(countMissingBlockNow): New function.
(countFilteredBlockNow): New function.
(getFilteredTotalLengthNow): New function.
(getCompletedLengthNow): New function.
(getFilteredCompletedLengthNow): New function.
(updateCache): New function.
* src/AbstractBtMessage.h
(BtMessageDispatcher.h): New include.
(PeerConnection.h): New include.
(BtRequestFactory.h): New include
(BtMessageFactory.h): New include.
(dispatcher): New variable.
(messageFactory): New variable.
(peerConnection: New variable.
(setBtMessageDispatcher): New function.
(setPeerConnection): New function.
(setBtMessageFactory): New function.
(setBtRequestFactory): New function.
* src/DefaultBtMessageFactory.cc
(setCommonProperty): Set dispatcher, requestFactory, this,
peerConnection to msg.
* src/BtRegistry.h
(BT_MESSAGE_RECEIVER): New macro.
* src/PeerConnection.h
(PeerConnectionWeakHandle): New type definition.
* src/BtMessageFactory.h
(BtMessageFactoryWeakHandle): New type definition.
* src/BitfieldMan.cc
(BitfieldMan): Added cachedNumMissingBlock,
cachedNumFilteredBlock,
cachedCompletedLength, cachedFilteredComletedLength,
cachedFilteredTotalLength.
Call updateCache().
(countMissingBlock): Return cachedNumMissingBlock.
(countMissingBlockNow): New function.
(countBlock): Return cachedNumFilteredBlock if filterEnabled is
true.
(countFilteredBlockNow): New function.
(setBit): Call updateCache().
(unsetBit): Call updateCache().
(setBitfield): Call updateCache().
(clearAllBit): Call updateCache().
(setAllBit): Use setBitInternal instead of setBit.
Call updateCache().
(addFilter): Call updateCache().
(enableFilter): Call updateCache().
(disableFilter): Call updateCache().
(clearFilter): Call updateCache().
(getFilteredTotalLength): Return cachedFilteredTotalLength.
(getFilteredTotalLengthNow): New function.
(getCompletedLength): Return cachedCompletedLength.
(getCompletedLengthNow): New function.
(getFilteredCompletedLength): Return
cachedFilteredComletedLength.
(getFilteredCompletedLengthNow): New function.
(updateCache): New function.
* src/BtMessageReceiver.h
(BtMessageReceiverWeakHandle): New type definition.
* src/DefaultBtMessageReceiver.cc
(receiveHandshake): Use messageFactory member.
(sendHandshake): Use messageFactory member.
(receiveMessage): Use messageFactory member.
* src/DefaultBtMessageFactory.h
(dispatcher): New variable.
(requestFactory): New variable.
(peerConnection): New variablle.
(setBtMessageDispatcher): New function.
(setBtRequestFactory): New function.
(setPeerConnection): New function.
* src/SharedHandle.h
(RefCount): New class.
(WeakHandle): New class.
* src/PeerObject.h
(BtMessageReceiver.h): New include.
(PeerObject): Added btMessageReceiver.
(btMessageReceiver): New variable.
* src/Util.cc
(countBit): Simplified.
* src/BtCancelMessage.cc
(doReceivedAction): Use dispatcher member.
* src/BtRequestFactory.h
(BtRequestFactoryWeakHandle): New type definition.
* src/PeerStorage.h
(downloadSpeed): int -> uint32_t
(uploadSpeed): int -> uint32_t
(sessionDownloadLength): long long int -> uint64_t
(sessionUploadLength): long long int -> uint64_t
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.
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.
To divide TorrentMan into 6 classes: BtContext, BtRuntime,
PeerStorage, PieceStorage, BtAnnounce and BtProgressInfoFile
* src/TrackerWatcherComand.h: Made subclass of
BtContextAwareCommand.
* src/SeedCheckCommand.cc: Use pieceStorage, btRuntime
* src/PeerAbstractCommand.h: Made subclass of
BtContextAwareCommand.
* src/PeerAbstractCommand.cc: Use btRuntime.
* src/BtContextAwareCommand.h: New class.
* src/FileEntry.h: Added accessor methods for following
variables.
(path): Made private.
(length): Made private.
(offset): Made private.
(extracted): Made private.
(requested): Made private.
(FileEntries): New definition.
(FileEntryHandle): New definition.
* src/FileEntry.cc: New file.
* src/HaveEraseCommand.h: Made subclass of
BtContextAwareCommand.
* src/HaveEraseCommand.cc: Use btRuntime, pieceStorage.
* src/PeerChokeCommand.h: Made subclass of
BtContextAwareCommand.
* src/PeerChokeCommand.cc: Use btRuntime, peerStorage,
pieceStorage.
* src/PieceStorage.h: New file.
* src/PeerInteractionCommand.h: Use btContext.
* src/PeerInteractionCommand.cc: Use pieceStorage, peerStorage,
btRuntime.
* src/DefaultBtProgressInfoFile.h: New file.
* src/DefaultBtProgressInfoFile.cc: New file.
* src/File.cc
(Util.h): New include.
(mkdirs): New function.
* src/MultiDiskAdaptor.h
(mkdir): New function.
* src/PeerListProcessor.h
(Peers): Removed.
* src/PeerInteraction.h
(torrentMan): Removed.
(btContext): New variable.
(peerStorage): New variable.
(pieceStorage): New variable.
(btAnnounce): New variable.
(getTorrentMan): Removed.
(getBtContext): New function.
* src/PeerInteraction.cc: Use btContext, peerStorage,
pieceStorage,
btAnnounce.
* src/HandshakeMessage.h
(TorrentMan.h): Removed.
* src/HandshakeMessage.cc: Use btContext.
* src/DefaultBtAnnounce.cc: New file.
* src/MultiDiskWriter.cc: Use the accessor methods of FileEntry.
* src/DefaultPieceStorage.cc: New file.
* src/DefaultBtContext.h: New file.
* src/TorrentRequestInfo.cc: Use btContext, pieceStorage.
Use the accessor methods of FileEntry.
* src/CookieBox.cc: Updated to use Util::slice().
* src/PieceMessage.cc: Use btContext, pieceStorage.
* src/common.h (SharedHandle.h): New include.
* src/PeerMessage.cc (PeerMessage): Added btContext,
peerStorage,
pieceStorage.
* src/TorrentAutoSaveCommand.h: Made subclass of
BtContextAwareCommand.
* src/DiskAdaptor.h
(topDir): Removed.
(getFileEntryFromPath): Changed the return type to
FileEntryHandle.
(setTopDir): Removed.
(getTopDir): Removed.
* src/BtContext.h: New file.
* src/DefaultPeerStorage.h: New file.
* src/PieceMessage.h (TorrentMan.h): Removed.
* src/RequestMessage.h (TorrentMan.h): Removed.
* src/TorrentDownloadEngine.h
(uploadLength): New variable.
(btContext): New variable.
(btRuntime): New variable.
(pieceStorage): New variable.
(peerStorage): New variable.
(btAnnounce): New variable.
(btProgressInfoFile): New variable.
(torrentMan): Removed.
(setBtContext): New function.
* src/TorrentDownloadEngine.cc: Use BtContext, BtRuntime,
pieceStorage,
peerStorage, btAnnounce, btProgressInfoFile.
* src/Piece.h
(toString): New function.
(Pieces): New type definition.
* src/Peer.h
(active): New variable.
(Peer): Added active.
(activate): Set active to true.
(deactivate): Set active to false.
(isActive): New function.
(Peers): New type definition.
* src/DirectDiskAdaptor.cc
(getFilePath): Use the accessor methods of FileEntry.
* src/TorrentConsoleDownloadEngine.h
(afterEachIteration): New function.
* src/TorrentConsoleDownloadEngine.cc
(haltRequested): New variable.
(sendStatistics): Use pieceStorage, btRuntime.
(afterEachIteration): New function.
* src/AnnounceList: AnnounceTier->AnnounceTierHandle.
* src/Directry.h
(Directory): New function.
(DirectoryHandle): New type definition.
* src/BtProgressInfoFile.h: New file.
* src/RequestMessage.cc: Use pieceStorage.
* src/BtRuntime.h: New file.
* src/DefaultBtContext.cc: New file.
* src/BitfieldMan.h
(getCompletedLength): New function(private).
(getCompletedLength): New function.
(getFilteredCompletedLength): New function.
* src/BitfieldMan.h
(getCompletedLength): New function(private).
(getCompletedLength): New function.
(getFilteredCompletedLength): New function.
* src/MultiDiskAdaptor.cc
(mkdir): New function.
(openFile): Call mkdir().
(initAndOpenFile): Call mkdir().
* src/CancelMessage.h
(TorrentMan.h): Removed.
* src/RejectMessage.h
(TorrentMan.h): Removed.
* src/DownloadEngineFactory.cc
(DefaultPieceStorage.h): New include.
(DefaultPeerStorage.h): New include.
(DefaultBtAnnounce.h): New include.
(DefaultBtProgressInfoFile.h): New include.
(newTorrentConsoleEngine): Rewritten.
* src/ShareRatioSeedCriteria.h
(torrentMan): Removed.
(btContext): New variable.
(peerStorage): New variable.
(btRuntime): New variable.
(evaluate): Use btContext, btRuntime, peerStorage.
* src/AnnounceTier.h: New file.
* src/BtAnnounce.h: New file.
* src/BtRegistry.h: New file.
* src/PeerInitiateConnectionCommand.h: Added btContext.
* src/PeerConnection.h (TorrentMan.h): Removed.
* src/PeerMessageFactory.cc: Use btContext, pieceStorage.
* src/Util.h
(slice): Added an argument.
* src/Util.cc
(slice): Added an argument to control whether trim is made or
not.
* src/PeerStorage.h: New file.
* src/BtRegistry.cc: New file.
* src/TrackerUpdateCommand.h: Made subclass of
BtContextAwareCommand.
* src/CopyDiskAdaptor.cc: Use the accessor methods of FileEntry.
* src/MultiDiskWriter.h: FileEntry -> FileEntryHandle
* src/PeerListenCommand.cc: Use btRuntime, peerStorage,
btContext.
* src/TorrentRequestInfo.h
(e): Removed.
(showFileEntry): Added an argument.
(getDownloadEngine): Return 0.
* src/DefaultBtAnnounce.h: New file.
* src/TorrentAutoSaveCommand.cc: Use btRuntime,
btProgressInfoFile.
* src/TrackerWatcherComand.cc: Use btRuntime, btAnnounce,
* src/PeerMessageFactory.h
(btContext): New variable.
(pieceStorage): New variable.
* src/TrackerUpdateCommand.cc: Use btRuntime, peerStorage,
btContext,
btAnnounce.
* src/DiskAdaptor.cc
(DiskAdaptor): Removed topDir.
(~DiskAdaptor): Removed topDir.
* src/PeerListenCommand.h: Made subclass of
BtContextAwareCommand.
* src/SeedCheckCommand.h: Made subclass of
BtContextAwareCommand.
* src/File.h (mkdirs): New function.
* src/DefaultPeerStorage): New file.
* src/DownloadEngineFactory.h
(newTorrentConsoleEngine): Use btContext.
* src/BtContextAwareCommand.cc: New file.
* src/PeerInitiateConnectionCommand.cc: Use btRuntime,
peerStorage.
* src/PeerMessage.h
(btContext): New variable.
(peerStorage): New variable.
(pieceStorage): New variable.
(setBtContext): New function.
* src/Directry.cc
(Directory): New function.
(createDir): Do nothing if name.size() == 0.
* src/AnnounceList.h
(AnnounceTier): Removed.
(AnnounceTiers): Removed.
* src/DefaultPieceStorage.h: New file.
* src/Piece.cc (toString): New function.
To fix typo:
* src/main.cc (showVersion): Fixed typo.
To fix compile warning:
* src/DelegatingPeerListProcessor.cc
(canHandle): Added "return false".
To simplify TrackerWatherCommand, TrackerUpdateCommand and
make the process of announce request testable.
* src/TrackerWatcherCommand.h
(TimeA2.h): Removed.
(interval): Removed.
(checkPoint): Removed.
(createRequestCommand): Added an argument 'url'.
(TrackerWatherCommand): Removed interval.
(createCommand): New function.
* src/DownloadEngineFactory.cc
(newTorrentConsoleEngine): Updated according to the changes in
TrackerWatherCommand.
* src/TorrentMan.cc
(DelegatingPeerListProcessor.h): New includes.
(TorrentMan): Added the initialization of announceInterval.
(isStoppedAnnounceReady): New function.
(isCompletedAnnounceReady): New function.
(isDefaultAnnounceReady): New function.
(isAnnounceReady): New function.
(getAnnounceUrl): New function.
(announceStart): New function.
(announceFailure): New function.
(announceSuccess): New function.
(isAllAnnounceFailed): New function.
(resetAnnounce): New function.
(processAnnounceResponse): New function.
(needMorePeerConnection): New function.
(noMoreAnnounce): New function.
* src/TrackerUpdateCommand.h
(getTrackerResponse): int->size_t
* src/TorrentMan.h
(isStoppedAnnounceReady): New function.
(isCompletedAnnounceReady): New function.
(isDefaultAnnounceReady): New function.
(announceInterval): New variable.
(isAnnounceReady): New function.
(getAnnounceUrl): New function.
(announceStart): New function.
(announceFailure): New function.
(announceSuccess): New function.
(isAllAnnounceFailed): New function.
(resetAnnounce): New function.
(processAnnounceResponse): New function.
(needMorePeerConnection): New function.
(noMoreAnnounce): New function.
* src/TrackerWatcherCommand.cc
(TrackerWatherCommand): Removed interval and checkPoint.
(execute): Rewritten.
(createCommand): New function.
(createRequestCommand): Rewritten.
* src/TrackerUpdateCommand.cc
(MetaFileUtil.h): Removed.
(DelegatingPeerListProcessor.h): Removed.
(getTrackerResponse): int->size_t. Use torrentMan's new
functions.
To add timeout to async name resolution:
* src/AbstractCommand.h
(nameResolveFinished): New function. This is not elegant way. It needs
to be more refined.
(nameResolverCheck): New variable.
* src/AbstractCommand.cc
(AbstractCommand): Added nameResolverCheck.
(execute): Added the check whether the name resolution has finished.
(setNameResolverCheck): Set nameResolverCheck to true.
(disableNameResolverCheck): Set nameResolverCheck to false.
(nameResolverFinished): New function.
* src/FtpInitiateConnectionCommand.h
(nameResolverFinished): New function.
* src/HttpInitiateConnectionCommand.h
(nameResolverFinished): New function.
To add the support for a non-compact response from a tracker:
* src/PeerListProcessor.h: New class.
* src/DefaultPeerListProcessor.h: New class.
* src/DefaultPeerListProcessor.cc: New class.
* src/CompactPeerListProcessor.h: New class.
* src/CompactPeerListProcessor.cc: New class.
* src/DelegatingPeerListProcessor.h: New class.
* src/DelegatingPeerListProcessor.cc: New class.
* src/TorrentMan.cc
(addPeer): New function(overload).
(addPeer): Delete unused peers only when new peer is added.
* src/TorrentMan.h
(PeerListProcessor.h): Included.
(Peers): Removed.
(addPeer): New function(overload).
* src/TrackerUpdateCommand.cc
(netinet/in.h): Removed.
(DelegatingPeerListProcessor.h): Included.
(execute): Updated to use DelegatingPeerListProcessor.
To fix the memory leak in TorrentMan::peers:
* src/PeerAbstractCommand.cc
(onAbort): Added peer->resetStatus().
* src/Peer.h
(resetStatus): Made public.
To improve the precision of the speed calculation:
* src/SpeedCalc.h
(nextInterval): New variable.
* src/SpeedCalc.cc
(reset): Added nextInterval.
(isIntervalOver): Use nextInterval instead of CHANGE_INTERVAL_SEC.
(changeSw): Set nextInterval to 15 seconds relative to the current
instant time.
* src/main.cc
(showVersion): Updated.
To rewrite segment download mechanism for HTTP/FTP download.
Use BitfieldMan to manage segment download.
* src/HttpResponseCommand.h
(executeInternal): Pass the reference of segment.
* src/AbstractCommand.cc
(prepareForRetry): Call segmentMan->cancelSegment here.
(onAbort): Call segmentMan->cancelSegment here.
* src/HttpDownloadCommand.cc
(prepareForNextSegment): New function.
* src/DownloadEngineFactory.cc
(newConsoleEngine): Removed splitter.
(newTorrentConsoleEngine): Removed splitter.
* src/Request.h
(segment): Renamed from seg.
* src/FtpInitiateConnectionCommand.h
(executeInternal): Pass the reference of segment.
* src/AbstractCommand.h
(executeInternal): Pass the reference of segment.
* src/pref.h
(PREF_SEGMENT_SIZE): New definition.
* src/HttpProxyRequestCommand.h
(executeInternal): Pass the reference of segment.
* src/HttpResponseCommand.cc
(checkResponse): Allowed status 206 when a request range starts
0.
(handleDefaultEncoding): Rewritten the code related to Segment.
(handleOtherEncoding): Rewritten the code related to Segment.
* src/SegmentMan.h
(SegmentEntry): New class.
(SegmentEntries): New type definition.
(bitfield): New variable.
(usedSegmentEntries): New variable.
(onNullBitfield): New function.
(checkoutSegment): New function.
(segments): Removed.
(splitter): Removed.
(unregisterId): Removed.
(getSegment): New function(overload)
(getDownloadedSize): Removed.
(cancelSegment): New function.
(completeSegment): New function.
(initBitfield): New function.
(hasSegment): New function.
(getDownloadLength): New function.
* src/BitfieldMan.h
(getStartIndex): New function.
(getEndIndex): New function.
(getMissingUnusedIndex): New function(overload).
(getSparseMissingUnusedIndex): New function.
* src/BitfieldMan.cc
(getMissingIndexRandomly): Handle the last byte of bitfield
properly.
(getMissingUnusedIndex): New function(overload).
(Range): New class.
(getStartIndex): New function.
(getEndIndex): New function.
(getSparseMissingUnusedIndex): New function.
(isBitSetInternal): Return false if the given index is less than
0.
* src/HttpInitiateConnectionCommand.h
(executeInternal): Pass the reference of segment.
* src/FtpNegotiateCommand.h
(executeInternal): Pass the reference of segment.
* src/FtpNegotiateCommand.cc
(recvSize): Initialize bitfield here.
* src/FtpTunnelResponseCommand.h
(executeInternal): Pass the reference of segment.
* src/HttpConnection.cc
(createRequest): Rewritten range header processing.
* src/DownloadCommand.h
(executeInternal): Pass the reference of segment.
(prepareForRetry): Removed.
(prepareForNextSegment): Added an argument segment. Made it a
virtual
function.
* src/main.cc
(main): Set the initial value of PREF_SEGMENT_SIZE to 1MB.
* src/SegmentMan.cc
(SegmentMan): Added bitfield. Removed splitter.
(~SegmentMan): Added bitfield. Removed splitter.
(unregisterId): Removed.
(getSegment): Rewritten.
(updateSegment): Rewritten.
(save): Rewritten.
(read): Rewritten.
(finished): Rewritten.
(getDownloadedSize): Removed.
(initBitfield): New function.
(FindSegmentEntryByIndex): New function object.
(FindSegmentEntryByCuid): New function object.
(checkoutSegment): New function.
(onNullBitfield): New function.
(getSegment): New function(overload).
(CancelSegment): New function object.
(cancelSegment): New function.
(completeSegment): New function.
(hasSegment): New function.
(getDownloadLength): New function.
* src/FtpInitiateConnectionCommand.cc
(executeInternal): Load .aria2 file after hostname resolution
finishes.
* src/Segment.h: Rewritten.
* src/Segment.cc (operator<<): New function.
* src/HttpDownloadCommand.h
(prepareForNextSegment): New function.
* src/Request.cc
(resetUrl): Made segment null.
* src/DownloadEngine.cc
(~DownloadEngine): Call cleanQueue before deleting segmentMan.
* src/HttpProxyRequestCommand.h
(executeInternal): Pass the reference of segment.
* src/DownloadCommand.cc
(executeInternal): Rewritten the code related to Segment.
(prepareForRetry): Removed.
(prepareForNextSegment): Rewritten.
* src/FtpTunnelResponseCommand.h
(executeInternal): Pass the reference of segment.
To add HTTP 1.1 persistent connection support(experimental)
* src/HttpRequestCommand.cc
(executeInternal): Disable keep alive if it is disabled by
configuration.
* src/Request.h
(keepAlive): New variable.
(isKeepAlive): New function.
(setKeepAlive): New function.
* src/pref.h
(PREF_HTTP_KEEP_ALIVE): New definition.
* src/HttpResponseCommand.cc
(executeInternal): Check the remote server supports keep alive.
* src/HttpConnection.cc
(createRequest): Send "Connection: close" only if keep alive is
disabled.
* src/main.cc
(main):
Set the initial value(false) of PREF_KEEP_ALIVE to false.
To add max download speed limit:
* src/pref.h
(PREF_MAX_SPEED_LIMIT): New definition.
* src/PeerInteractionCommand.cc
(executeInternal): Added max download speed limit. Not tested
yet.
* src/SegmentMan.h
(PeerStats): New type definition.
(peerStats): New variable.
(registerPeerStat): New function.
(FindPeerStat): New function object.
(getPeerStat): New function.
(calculateDownloadSpeed): New function.
* src/SpeedCalc.h: New class.
* src/SpeedCalc.cc: New class.
* src/main.cc
(main):
Set the initial value of PREF_MAX_SPEED_LIMIT to 0(which means
the
download speed is not restricted).
* src/PeerStat.h: New class.
* src/SegmentMan.cc
(registerPeerStat): New function.
(calculateDownloadSpeed): New function.
* src/DownloadCommand.cc
(STARTUP_IDLE_TIME): New definition.
(DownloadCommand): Register peerStat to segmentMan. Call
peerStat->
downloadStart.
(~DownloadCommand): Call peerStat->downloadStop.
(executeInternal): Added download speed limitter. Rewritten
lowest
speed limitter.
* src/HttpConnection.cc
(receiveResponse): Fixed: eohIndex[headerBuf] ->
headerBuf[eohIndex].
* src/AbstractCommand.cc
(resolveHostname): Throw DlAbortEx if a name resolution failes.
Added hostname to the error message.
* src/ConsoleDownloadEngine.cc
(calculateStatistics): Initialize psize with dlSize.
* src/PieceMessage.cc
(receivedAction): Do not call peerInteraction->abortPiece here.
(onGotWrongPiece): Call peerInteraction->abortPiece here.
* src/BitfieldMan.h
(clearAllUseBit): New function.
(setAllUseBit): New function.
* src/BitfieldMan.cc
(clearAllBit): Do not clear useBitfield here.
(clearAllUseBit): New function.
(setAllUseBit): New function.
* src/Piece.cc
(clearAllBlock): Call bitfield->clearAllUseBit().
To make filename URL-decoded:
* src/HttpResponseCommand.h: Updated doc.
* src/HttpResponseCommand.cc
(determinFilename): Made filename URL-decoded.
* src/FtpInitiateConnectionCommand.cc
(executeInternal): Made filename URL-decoded.
* src/Util.h (urldecode): New function.
* src/Util.cc (urldecode): New function.
To add --seed-time and --seed-ratio command-line option:
* src/Option.h (getAsDouble): New function.
* src/Option.cc (getAsDouble): New function.
* src/SeedCheckCommand.h: New class.
* src/SeedCheckCommand.cc: New class.
* src/DownloadEngineFactory.cc
(SeedCheckCommand.h): Included.
(UnionSeedCriteria.h): Included.
(TimeSeedCriteria.h): Included.
(ShareRatioSeedCriteria.h): Included.
(newTorrentConsoleEngine): Added the processing of seed option.
* src/SeedCriteria.h: New class.
* src/ShareRatioSeedCriteria.h: New class.
* src/TimeSeedCriteria.h: New class.
* src/UnionSeedCriteria.h: New class.
* src/prefs.h
(PREF_SEED_TIME): New definition.
(PREF_SEED_RATIO): New definition.
* src/main.cc
(showUsage): Added --seed-time and --seed-ratio option.
(main): Added --seed-time and --seed-ratio option.
Made default log file name "/dev/null".
* src/SharedHandle.h
(SharedHandle): Copy constructor. Made it assignable from the
SharedHandle of the subclasses.
(operator=): Made it assignable from the SharedHandle of the
subclasses.
(getRefCount): New function.
To add notice log level and the switch to write log to stdout.
This
switch is configurable per log level.
* src/Logger.h
(notice): New function.
(LEVEL): Added NOTICE. Assigned an explicit value to each log
level
constant.
* src/LogFactory.cc
(getInstance): The use of NullLogger was removed. A log message
with
notice log level was made written to stdout along with log file.
* src/NullLogger.h
(notice): New function.
* src/SimpleLogger.h
(writeHeader): Added the 'file' argument.
(writeLog): Added the 'file' argument.
(writeFile): New function.
(stdoutField): New variable.
(SimpleLogger): Removed the default constructor.
(SimpleLogger): Made the default value of logfile 0.
(debug): Added 'virtual' keyword.
(info): Added 'virtual' keyword.
(warn): Added 'virtual' keyword.
(error): Added 'virtual' keyword.
(notice): New function.
(setStdout): New function.
* src/SimpleLogger.cc
(WRITE_LOG): Replaced writeLog with writeFile.
(WRITE_LOG_EX): Replaced writeLog with writeFile.
(SimpleLogger): Removed the default constructor.
(setStdout): New function.
(writeLog): Added the handling of NOTICE log level.
(writeFile): New function.
(notice): New function.
* src/TorrentMan.h: Updated doc.
* src/BitfieldMan.h: Updated doc.
* src/TrackerWatcherCommand.cc
(execute): Return true if error occurred in the request to the
tracker
and halt is requested.
* src/TrackerUpdateCommand.cc
(execute): Return true if error occurred in the request to the
tracker
and halt is requested.
* src/TorrentConsoleDownloadEngine.h
(onSelectiveDownloadingCompletes): Removed.
* src/TorrentConsoleDownloadEngine.cc
(onSelectiveDownloadingCompletes): Removed.
* src/TorrentDownloadEngine.h
(onEndOfRun): Added 'virtual' keyword.
(afterEachIteration): Removed.
(onSelectiveDownloadingCompletes): Removed.
* src/TorrentDownloadEngine.cc
(onEndOfRun): Removed filenameFixed.
(afterEachIteration): Removed.
* src/TorrentMan.cc
(completePiece): Call onDownloadComplete here.
(onDownloadComplete): Added 2 log messages.
To fix compilation problem on gcc4.1.1(patch#1542283 by
tizianomueller)
* src/NameResolver.h: Added the prototype declaration of
callback().
To support c-ares library:
* src/AbstractCommand.cc: Replaced HAVE_LIBARES with
ENABLE_ASYNC_DNS
* src/FeatureConfig.cc: Replaced HAVE_LIBARES with
ENABLE_ASYNC_DNS
* src/FtpInitiateConnectionCommand.h:
Replaced HAVE_LIBARES with ENABLE_ASYNC_DNS
* src/AbstractCommand.h: Replaced HAVE_LIBARES with
ENABLE_ASYNC_DNS
* src/HttpInitiateConnectionCommand.h:
Replaced HAVE_LIBARES with ENABLE_ASYNC_DNS
* src/NameResolver.cc: Replaced HAVE_LIBARES with
ENABLE_ASYNC_DNS
* src/HttpInitiateConnectionCommand.cc:
Replaced HAVE_LIBARES with ENABLE_ASYNC_DNS
* src/FtpInitiateConnectionCommand.cc:
Replaced HAVE_LIBARES with ENABLE_ASYNC_DNS
* src/DownloadEngine.h:
Replaced HAVE_LIBARES with ENABLE_ASYNC_DNS
* src/DownloadEngine.cc:
Replaced HAVE_LIBARES with ENABLE_ASYNC_DNS
* 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.
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
* src/TorrentMan.h:
(advertisePiece): Updated doc.
(getAdvertisedPieceIndexes): Updated doc.
(removeAdvertisedPiece); New function.
* src/TorrentMan.cc
(FindElapsedHave): New function object.
(removeAdvertisedPiece): New function.
* src/HaveEraseCommand.h: New class.
* src/HaveEraseCommand.cc: New class.
* src/FeatureConfig.h: New class.
* src/FeatureConfig.cc: New class.
* src/Request.h
(defaultPorts): Removed.
* src/Request.cc
(FeatureConfig.h): Included.
(Request): Removed the statements related to defaultPorts.
(parseUrl): Removed metalinkEnabled. Use FeatureConfig instead.
A default port number is now retrieved from FeatureConfig.
* src/main.cc
(HaveEraseCommand.h): Included.
(showVersion): Added the output of feature list.
(main): Added HaveEraseCommand to command queue in BitTorrent
downloading.
* src/PeerInteractionCommand.h
(chokeCheckPoint): Commented out.
(periodicExecPoint): New variable.
* src/PeerInteractionCommand.cc
(executeInternal): Following methods are now called in at least
every
0.5 seconds to reduce CPU usage:
detectMessageFlooding(), peerInteraction->checkRequestSlot(),
checkHave(), sendKeepAlive().
(checkLongTimePeerChoking): Commented out.
* src/BitfieldMan.h
(getNthBitIndex): Changed the method signature.
(getMissingIndexRandomly): Changed the method signature.
* src/BitfieldMan.cc
(getNthBitIndex): Rewritten
(getMissingIndexRandomly): Rewritten.
(hasMissingPiece): Rewritten.
(getMissingIndex): Refactored.
(getMissingUnusedIndex); Refactored.
(getMissingIndex): Refactored.
To add the support for Metalink3.0 backward compatible links:
* src/Request.h
(SAFE_CHARS): Added '#'.
(METALINK_MARK): New definition.
* src/Request.cc
(parseUrl): Added the support for Metalink3.0 backward
compatible
links.
etc
* src/PeerInteraction.cc
(MsgPushBack): Removed.
(sendMessages): Use STL copy and back_inserter.
(rejectAllPieceMessageInQueue): Use STL copy and back_inserter.
(rejectPieceMessageInQueue): Use STL copy and back_inserter.
* src/TorrentMan.h
(MAX_PEER_LIST_SIZE): Changed to 100 from 250.
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 add Metalink support(http/ftp only):
* src/AbstractCommand.h
(tryReserved): New function.
* src/AbstractCommand.cc
(execute): Call tryReserved().
(tryReserved): New function.
* src/Request.h
(Requests): New type definition.
* src/SegmentMan.h
(reserved): New variable.
* src/Util.h
(fileChecksum): New function.
(toUpper): New function.
(toLower): New function.
* src/Util.cc
(messageDigest.h): Included.
(trim): Trim \r\n\t.
(fileChecksum): New function.
(toUpper): New function.
(toLower): New function.
* src/main.cc
(normalDownload): New function.
(main): Added 2 command-line options: metalink-file,
metalink-connection. Their usage has not been written yet.
* src/MetalinkProcessor.h: New class.
* src/Xml2MetalinkProcessor.h: New class.
* src/Xml2MetalinkProcessor.cc: New class.
* src/MetalinkEntry.h: New class.
* src/MetalinkEntry.cc: New class.
* src/MetalinkResource.h: New class.
* src/MetalinkResource.cc: New class.
To add md5 message digest checking:
* src/messageDigest.h: Rewritten.
* src/MultiDiskWriter.cc: Updated according to the changes in
messageDigest.h.
* src/ShaVisitor.cc: Updated according to the changes in
messageDigest.h.
* src/Util.cc: Updated according to the changes in
messageDigest.h.
* src/AbstractDiskWriter.cc: Updated according to the changes in
messageDigest.h.
To fix a bug that causes segfault when the payload length in
peer
message is less than 0:
* src/PeerConnection.cc:
(receiveMessage): Fixed the bug.
* src/PeerMessageUtil.cc
(checkLength): Throw an exception if length is less than or
equals to
0.
To add new interfaces to Base64 encoding/decoding:
* src/Base64.h
(part_encode): Changed the method signature.
(encode): New function(overload).
(decode): New function(overload).
* src/Base64.cc
(part_encode): Rewritten.
(encode): Rewritten.
(encode): New function(overload).
To prevent a peer to download same piece if there is an error in
checksum:
* src/PieceMessage.cc
(receivedAction): Call peerInteraction->abortPiece().
To make a listening socket non-block:
* src/SocketCore.h
(setNonBlockingMode): New function.
* src/SocketCore.cc
(setNonBlockingMode): New function.
(beginListen): Added a call to setNonBlockingMode().
(acceptConnection): Call setNonBlockingMode().
(setBlockingMode): Updated.
To handle tracker's NAT-checking:
* src/PeerConnection.cc
(receiveHandshake): 'msg' param is filled with received data and
its length is assigned to 'length' param, even if all handshake
message is not yet received.
* src/PeerInteractionCommand.cc
(executeInternal): Use peerInteraction->receiveHandshake(true)
when
a new peer connects to localhost.
A call to peerInteraction->sendHandshake() was removed because
it is called from peerInteraction->receiveHandshake(true).
* src/PeerInteraction.h
(quickReplied): New variable.
(receiveHandshake): Added an argument.
* src/PeerInteraction.cc
(PeerInteraction): Added the initialization of quickReplied.
(receiveHandshake): Send handshake message as soon as the info
hash
in a handshake message from a peer is correct.
To change the random part of peer id and key parameter:
* src/TorrentMan.h
(key): New variable.
* src/TorrentMan.cc
(setupInternal1): Use Util::randomAlpha() to generate random
part
of peer id, which is now "-aria2-"+13 alphabet
characters([A-Za-z]).
key is also generated by Util::randomAlpha() and it is now 8
character
long.
* src/Util.h
(randomAlpha): New function.
* src/Util.cc
(randomAlpha): New function.
* src/TrackerWatcherCommand.cc
(execute): In a tracker request: Use torrentMan->key as key
parameter.
Added no_peer_id=1.
Set snubbing flag to false when a choke message is received from
a
snubbed peer.
* src/ChokeMessage.cc
(receivedAction): Set snubbing flag to false.
* src/TorrentMan.cc (setupInternal1): Fixed peerId generation
bug.
* src/SimpleLogger.h (writeHeader): New function.
* src/SimpleLogger.cc (writeHeader): New function.
(writeLog): Fixed the bug that causes segfaults if exception
message
contains an unescaped "%" character.
* src/TrackerWatcherCommand.cc (execute): Added a short sleep
when a tracker request fails.
* src/Request.cc (parseUrl): Query string is now handled
properly.
To remove a wait from download loop:
* src/DownloadEngine.cc
(run): Comment out shortSleep.
To rewrite the message handling:
* src/CancelMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(create): New function.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/CancelMessage.cc
(create): New function.
(receivedAction): Replaced deleteRequestMessageInQueue with
rejectPieceMessageInQueue.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/BitfieldMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(msgLength): New variable.
(~BitfieldMessage): Deleted msg.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/BitfieldMessage.cc
(create): New function.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/ChokeMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(sendPredicate): New function.
(onSendComplete): New function.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
(create): New function.
* src/ChokeMessage.cc
(create): New function.
(send): Removed.
(sendPredicate): New function.
(getMessage): New function.
(getMessageLength): New function.
(onSendComplete): New function.
* src/KeepAliveMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/KeepAliveMessage.cc
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/PortMessage.h
(create): New function.
(receivedAction): Updated log message.
* src/PortMessage.cc: New file.
* src/UnchokeMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(sendPredicate): New function.
(onSendComplete): New function.
(create): New function.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/UnchokeMessage.cc
(create): New function.
(send): Removed.
(sendPredicate): New function.
(getMessage): New function.
(getMessageLength): New function.
(onSendComplete): New function.
* src/PieceMessage.h
(leftPieceDataLength): Removed.
(leftDataLength): New variable.
(headerSend): New variable.
(pendingCount): New variable.
(msgHeader): New variable.
(sendPieceData): New function.
(incrementPendingCount): New function.
(isPendingCountMax): New function.
(create): New function.
(getMessageHeader): New function.
(getMessageHeaderLength): New function.
* src/PieceMessage.cc
(create): New function.
(getMessageHeader): New function.
(getMessageHeaderLength): New function.
(send): Rewritten.
(sendPieceData): New function.
* src/HaveMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(create): New function.
(getMessage): New function.
(getMessageLength): New function.
* src/HaveMessage.cc
(create): New function.
(send): Removed.
(sendPieceData): New function.
(getMessage): New function.
(getMessageLength): New function.
* src/RequestMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(create): New function.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/RequestMessage.cc
(create): New function.
(receivedAction): Added the handling of fast extension.
Deleted torrentMan->addUploadLength,
torrentMan->addDeltaUploadLength.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/InterestedMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(sendPredicate): New function.
(onSendComplete): New function.
(create): New function.
(getMessage): New function.
(getMessageLength): New function.
* src/InterestedMessage.cc
(create): New function.
(send): Removed.
(sendPieceData): New function.
(getMessage): New function.
(getMessageLength): New function.
(onSendComplete): New function.
* src/NotInterestedMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(sendPieceData): New function.
(onSendComplete): New function.
(create): New function.
(send): Removed.
(getMessage): New function.
(getMessageLength): New function.
* src/NotInterestedMessage.cc
(create): New function.
(send): Removed.
(sendPredicate): New function.
(getMessage): New function.
(getMessageLength): New function.
(onSendComplete): New function.
* src/AllowedFastMessage.h: New class.
* src/AllowedFastMessage.cc: New class.
* src/RejectMessage.h: New class.
* src/RejectMessage.cc: New class.
* src/SuggestPieceMessage.h: New class.
* src/SuggestPieceMessage.cc: New class.
* src/HaveAllMessage.h: New class.
* src/HaveAllMessage.cc: New class.
* src/HaveNoneMessage.h: New class.
* src/HaveNoneMessage.cc: New class.
* src/HandshakeMessage.h: Derived from SimplePeerMessage.
(msg): New variable.
(reserved): New variable.
(create): New function.
(getId): New function.
(receivedAction): New function.
(getMessage): New function.
(getMessageLength): New function.
(isFastExtensionSupported): New function.
* src/HandshakeMessage.cc
(HandshakeMessage): Moved here from HandshakeMessage.h.
(create): New function.
(getMessage): New function.
(getMessageLength): New function.
(toString): Added the output of reserved field.
(check): Added const qualifier.
(isFastExtensionSupported): New function.
* src/PeerMessageUtil.h
(createChokeMessage): Removed.
(createUnchokeMessage): Removed.
(createInterestedMessage): Removed.
(createNotInterestedMessage): Removed.
(createHaveMessage): Removed.
(createBitfieldMessage): Removed.
(createRequestMessage): Removed.
(createCancelMessage): Removed.
(createPieceMessage): Removed.
(createPortMessage): Removed.
(createChokeMessage): Removed.
(createUnchokeMessage): Removed.
(createInterestedMessage): Removed.
(createNotInterestedMessage): Removed.
(createHaveMessage): Removed.
(createBitfieldMessage): Removed.
(createRequestMessage): Removed.
(createCancelMessage): Removed.
(createPieceMessage): Removed.
(createKeepAliveMessage): Removed.
(createHandshakeMessage): Removed.
(setIntParam): New function.
(createPeerMessageString): New function.
* src/PeerMessageUtil.cc
(createChokeMessage): Removed.
(createUnchokeMessage): Removed.
(createInterestedMessage): Removed.
(createNotInterestedMessage): Removed.
(createHaveMessage): Removed.
(createBitfieldMessage): Removed.
(createRequestMessage): Removed.
(createCancelMessage): Removed.
(createPieceMessage): Removed.
(createPortMessage): Removed.
(createRequestMessage): Removed.
(createCancelMessage): Removed.
(createPieceMessage): Removed.
(createHaveMessage): Removed.
(createChokeMessage): Removed.
(createUnchokeMessage): Removed.
(createInterestedMessage): Removed.
(createNotInterestedMessage): Removed.
(createBitfieldMessage): Removed.
(createKeepAliveMessage): Removed.
(createHandshakeMessage): Removed.
(setIntParam): New function.
(createPeerMessageString): New function.
* src/PeerConnection.h
(peer): Removed.
(torrentMan): Removed.
(createNLengthMessage): Removed.
(setIntParam): Removed.
(writeOutgoingMessageLog): Removed all overloaded functions.
(PeerConnection): Deleted peer and torrentMan from its
arguments.
(sendMessage): New function.
(sendHandshake): Removed.
(sendKeepAlive): Removed.
(sendChoke): Removed.
(sendUnchoke): Removed.
(sendInterested): Removed.
(sendNotInterested): Removed.
(sendHave): Removed.
(sendBitfield): Removed.
(sendRequest): Removed.
(sendPiece): Removed.
(sendPieceHeader): Removed.
(sendPieceData): Removed.
(sendCancel): Removed.
(getPeer): Removed.
* src/PeerConnection.cc
(PeerConnection): Deleted peer and torrentMan from its
arguments.
(sendHandshake): Removed.
(sendKeepAlive): Removed.
(createNLengthMessage): Removed.
(setIntParam): Removed.
(writeOutgoingMessageLog): Removed all overloaded functions.
(sendChoke): Removed.
(sendUnchoke): Removed.
(sendInterested): Removed.
(sendNotInterested): Removed.
(sendHave): Removed.
(sendBitfield): Removed.
(sendRequest): Removed.
(sendPiece): Removed.
(sendPieceHeader): Removed.
(sendPieceData): Removed.
(sendMessage): New function.
(sendCancel): Removed.
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Call setUploadLimit.
(executeInternal): Call setUploadLimit.
Added the handling of "inProgress" state of handshake message.
Call sendBitfield() or sendAllowdFast() instead of deprecated
sendNow().
(keepAlive): Call addMessage and sendMessage instead of
deprecated
sendNow().
(beforeSocketCheck): Call addMessage instead of deprecated
trySendNow()
* src/TorrentMan.h
(PEER_ID_LENGTH): New definition.
(hasAllPieces): New function.
* src/TorrentMan.cc
(getMissingPiece): Added the handling of fast extension.
(cancelPiece): Call updatePiece().
(hasAllPieces): New function.
* src/PeerInteraction.h
(fastSet): New variable.
(getNewPieceAndSendInterest): Changed the return type to void.
(send): Renamed as sendMessages.
(deleteAllRequestSlot): Removed.
(deleteRequestMessageInQueue): Renamed as
rejectPieceMessageInQueue.
(cancelAllRequest): Removed all overloaded functions.
(deleteAllRequestSlot): Removed.
(deletePieceMessageInQueue): Renamed as
rejectAllPieceMessageInQueue.
(rejectPieceMessageInQueue): New function.
(rejectAllPieceMessageInQueue): New function.
(onChoked): New function.
(isSendingMessageInProgress): New function.
(getCorrespondingRequestSlot): Changed its arguments.
(isInFastSet): New function.
(addFastSetIndex): New function.
(addRequests): New function.
(sendNow): Removed.
(trySendNow): Removed.
(sendBitfield): New function.
(sendAllowdFast): New function.
(createHaveAllMessage): New function.
(createHaveNoneMessage): New function.
(createRejectMessage): New function.
(createAllowedFastMessage): New function.
* src/PeerInteraction.cc
(send): Renamed as sendMessages.
(sendMessages): New function.
(MsgPushBack): New class.
(isSendingMessageInProgress): New function.
(deletePieceMessageInQueue): Renamed as
rejectAllPieceMessageInQueue.
(rejectAllPieceMessageInQueue): New function.
Added the handling of fast extension.
(deleteRequestMessageInQueue): Renamed as
rejectPieceMessageInQueue.
(rejectPieceMessageInQueue): New function.
Added the handling of fast extension.
(deleteRequestSlot): Replaced for loop with std::find.
(onChoked): New function.
(deleteAllRequestSlot): Removed.
(abortPiece): Rewirtten.
(deleteTimeoutRequestSlot): Updated log messages.
(getCorrespondingRequestSlot): Changed its arguments.
(cancelAllRequest): Removed all overloaded functions.
(receiveHandshake): Added the check to see whether an incoming
peer
supports fast extension.
(createHandshakeMessage): Use HandshakeMessage::create instead
of
PeerMessageUtil.
(createPeerMessage): Use create() of each message class instead
of
PeerMessageUtil.
HaveAllMessage, HaveNoneMessage, RejectMessage,
SuggestPieceMessage,
AllowedFastMessage were added.
(getNewPieceAndSendInterest): Changed its return value type to
void.
Added the handling of fast extension.
(addRequests): New function.
(sendNow): Removed.
(sendHandshake): Rewritten.
(trySendNow): Removed.
(sendBitfield): New function.
(sendAllowdFast): New function.
(isInFastSet): New function.
(addFastSetIndex): New function.
(createRequestMessage): Use RequestMessage::create instead of
PeerMessageUtil.
(createCancelMessage): Use CancelMessage::create instead of
PeerMessageUtil.
(createPieceMessage): Use PieceMessage::create instead of
PeerMessageUtil.
(createHaveMessage): Use HaveMessage::create instead of
PeerMessageUtil.
(createChokeMessage): Use ChokeMessage::create instead of
PeerMessageUtil.
(createUnchokeMessage): Use UnchokeMessage::create instead of
PeerMessageUtil.
(createInterestedMessage): Use InterestedMessage::create instead
of
PeerMessageUtil.
(createNotInterestedMessage): Use NotInterestedMessage::create
instead
of PeerMessageUtil.
(createBitfieldMessage): Use BitfieldMessage::create instead of
PeerMessageUtil.
(createKeepAliveMessage): Use KeepAliveMessage::create instead
of
PeerMessageUtil.
(createHaveAllMessage): New function.
(createHaveNoneMessage): New function.
(createRejectMessage): New function.
(createAllowedFastMessage: New function.
* src/Util.h
(sha1Sum): New function.
(computeFastSet): New function.
* src/Util.cc
(sha1Sum): New function.
(computeFastSet): New function.
* src/Peer.h
(fastExtensionEnabled): New variable.
(fastSet): New variable.
(setAllBitfield): New function.
(setFastExtensionEnabled): New function.
(isFastExtensionEnabled): New function.
(addFastSetIndex): New function.
(getFastSet): New function.
(isInFastSet): New function.
(countFastSet): New function.
* src/Peer.cc
(isInFastSet): New function.
(addFastSetIndex): New function.
(setAllBitfield): New function.
* src/AbstractCommand.cc (execute): Changed the procedure of
checking
sockets.
* src/PeerAbstractCommand.cc
(PeerAbstractCommand): Added the initialization for
uploadLimitCheck
and uploadLimit.
(execute): Changed the procedure of checking sockets. The upload
speed
checking were added.
(setUploadLimit): New function.
(setUploadLimitCheck): New function.
* src/PeerAbstractCommand.h
(setUploadLimit): New function.
(setUploadLimitCheck): New function.
(uploadLimit): New variable.
(uploadLimitCheck): New variable.
To contact a tracker regularly:
* src/TrackerWatcherCommand.h (interval): New variable.
(checkPoint): New variable.
(TrackerWatcherCommand): Added interval argument.
* src/TrackerWatcherCommand.cc
(TrackerWatcherCommand): Initialized checkPoint.
(execute): Now a tracker is contacted in every specified period.
If peer list is not needed, send request with numwant=0.
* src/TrackerUpdateCommand.cc
(execute): Updated log messages.
* src/DownloadEngine.cc
(~DownloadEngine): Removed two asserts.
(waitData): Uncommented wfds. May be a bug fix.
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.
* src/TorrentConsoleDownloadEngine.cc
(onPartialDownloadingCompletes): Renamed as
onSelectiveDownloadingCompletes.
(onSelectiveDownloadingCompletes): Updated message.
To add DiskAdaptor which abstract DiskWriter family:
* src/PeerConnection.cc: Use diskAdaptor instead of diskWriter.
* src/PeerInteractionCommand.cc: Use diskAdaptor instead of
diskWriter.
* src/BitfieldMan.cc (isAllBitSet): bug fix.
* src/TorrentMan.cc : Included CopyDiskAdaptor.h,
DirectDiskAdaptor.h,
MultiDiskAdaptor.h.
(readFileEntry): Changed its arguments.
(setup): setupDiskWriter is merged into this function.
(setupDiskWriter): Removed.
(setFileFilter): New function.
(readFileEntryFromMetaInfoFile): Updated according to the
changes
made in readFileEntry.
(getFilePath): Removed.
(getTempFilePath): Removed.
(getSegmentFilePath): Updated due to the removal of getFilePath.
(fixFilename): Removed.
(copySingleFile): Removed.
(splitMultiFile): Removed.
(deleteTempFile): Removed.
(setFileEntriesToDownload): Removed.
(isPartialDownloadingMode): Renamed as
isSelectiveDownloadingMode.
(isSelectiveDownloadingMode): New function.
(setAllMultiFileRequestedState): Removed.
(finishPartialDownloadingMode): Renamed as
finishSelectiveDownloadingMode.
(finishSelectiveDownloadingMode): New function.
(getPartialTotalLength): Renamed as getSelectedTotalLength.
(getSelectedTotalLength): New function.
(onDownloadComplete): Use diskAdaptor.
* src/MultiDiskWriter.cc (Constructor): Added the argument
pieceLength
(Range): Removed.
(setMultiFileEntries): Renamed as setFileEntries.
(setFileEntries): New function.
* src/MultiDiskWriter.h [DiskWriterEntry](enabled): Removed.
(pieceLength): New variable.
* src/main.cc (printDownloadCompeleteMessage): New function.
(torrentHandler): Use diskAdaptor instead of diskWriter.
(main): Renamed torrent-show-files to show-files.
Rewritten file contents listing.
* src/TorrentMan.h (FileEntry): Removed.
(multiFileTopDir): Removed.
(multiFileEntries): Removed.
(diskWriter): Removed.
(diskAdaptor): New variable.
* src/DefaultDiskWriter.h (totalLength): New variable.
* src/DefaultDiskWriter.cc (initAndOpenFile): Added ftruncate.
* src/TorrentDownloadEngine.cc (onEndOfRun): Use diskAdaptor
instead of
diskWriter.
* src/TorrentConsoleDownloadEngine.h
(partialDownloadLengthDiff): Renamed as
selectedDownloadLengthDiff.
(partialTotalLength): Renamed as selectedTotalLength.
* src/AbstractDiskWriter.cc (openFile): If file exists, call
openExistingFile, otherwise call initAndOpenFile.
(closeFile): fd > 0, not fd != 0.
* src/prefs.h (PREF_TORRENT_SHOW_FILES): Renamed as
PREF_SHOW_FILES
(PREF_SHOW_FILES): New definition.
To add the ability to download multi torrent into respective
files
directly:
* src/DiskWriter.h (openFile): New function.
(seek): Removed.
* src/MultiDiskWriter.h: New class.
* src/MultiDiskWriter.cc: New class.
* src/AbstractDiskWriter.h (seek): Changed its scope from public
to
protected.
(openFile): New function.
* src/AbstractDiskWriter.cc (openFile): New function.
* src/prefs.h (V_FALSE): New definition.
(PREF_DIRECT_FILE_MAPPING): New definition.
* src/TorrentMan.h (setupDiskWriter): New function.
(setAllMultiFileRequestedState): New function.
(onDownloadComplete): New function.
* src/TorrentMan.cc : Included MultiDiskWriter.h
(setupDiskWriter): New function.
(getFilePath): Updated.
(getTempFilePath): Updated.
(getSegmentFilePath): Updated.
(fixFilename): Updated.
(deleteTempFile): Updated.
(setAllMultiFileRequestedState): New function.
(setFileEntriesToDownload): Use setAllMultiFileRequestedState().
(finishPartialDownloadingMode): Reset requested flags.
(onDownloadComplete): New function.
* src/main.cc: Added --direct-file-mapping option.
Use TorretMan::setupDiskWriter().
* src/TorrentDownloadEngine.cc (afterEachIteration): Use
TorrentMan::
onDownloadComplete().
To fix ETA bug:
* src/Util.h (difftvsec): New function.
* src/Util.cc (difftvsec): New function.
* src/TorrentConsoleDownloadEngine.cc (calculateSpeed): Use int
for the
type of "elapsed" instead of long long int.
(calculateStatistics): Use Util::difftvsec instead of
Util::difftv.
The updates of statistics takes place every 1 seconds.
* src/TorrentConsoleDownloadEngine.h (lastElapsed): Changed its
type.
(calculateSpeed): Changed its argument signature.
* src/PeerMessage.cc (toString): Fixed message.
To print ETA:
* src/TorrentDownloadEngine.cc (afterEachIteration): Added
download
completion handling when dealing with
TorrentMan::isPartialDownloadingMode() == true.
* src/TorrentDownloadEngine.h (onPartialDownloadingCompletes):
New function.
* src/TorrentConsoleDownloadEngine.h (startup): New variable.
(sessionDownloadLength): New variable.
(avgSpeed): New variable.
(eta): New variable.
* src/TorrentConsoleDownloadEngine.cc (initStatistics):
Initialized
new variables: eta, avgSpeed, startup.
(calculateSpeed): Calculate average speed and ETA.
(printStatistics): Added ETA.
* src/Util.h (secfmt): New function.
* src/Util.cc (secfmt): New function.
2006-04-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To detect "keep alive" flooding:
* src/PeerInteractionCommand.h (keepAliveCount): New variable
* src/PeerInteractionCommand.cc (Constructor): Initialized new
variable: keepAliveCount.
(detectMessageFlooding): Added "keep alive" flooding detection.
(receiveMessage): Increase keepAliveCount when "keep alive"
message
received.
To add the ability to download only specified files in
multi-file
torrent:
* src/BitfieldMan.h (filterBitfield): New variable.
(filterEnabled): New variable.
(setFilterBit): New function.
(enableFilter): New function.
(disableFilter): New function.
(isFilterEnabled): New function.
(getFilteredTotalLength): New function.
(getCompletedLength): New function.
* src/BitfieldMan.cc (Constructor): Initialized new variable:
filterBitfield, filterEnabled.
(CopyConstructor): Added filterBitfield and filterEnabled.
(operator==): Added filterBitfield and filterEnabled.
(Destructor): Added filterBitfield.
(getMissingIndex): Use filterBitfield.
(getMissingUnusedIndex): Use filterBitfield.
(getFirstMissingUnusedIndex): Use filterBitfield.
(getFirstMissingUnusedIndex): Use filterBitfield.
(getAllMissingIndexes): Use filterBitfield.
(countMissingBlock): Use filterBitfield.
(countBlock): Use filterBitfield.
(setBitInternal): Added new argument on.
(setUseBit): Use setBitInternal.
(unsetUseBit): Use setBitInternal.
(setBit): Use setBitInternal.
(unsetBit): Use setBitInternal.
(isAllBitSet): Use filterBitfield.
(setFilterBit): New function.
(addFilter): New function.
(enableFilter): New function.
(disableFilter): New function.
(clearFilter): New function.
(isFilterEnabled): New function.
(getFilteredTotalLength): New function.
(getCompletedLength): New function.
* src/TorrentMan.h [FileEntry](Constructor): Updated signature.
Initalized newly added variables.
[FileEntry](offset): New variable.
[FileEntry](extracted): New variable.
[FileEntry](requested): New variable.
(readFileEntry): New function.
(option): New variable.
(splitMultiFile): Removed const qualifier.
(fixFilename): Removed const qualifier.
(readFileEntryFromMetaInfoFile): New function.
(finishPartialDownloadingMode): New function.
(isPartialDownloadingMode): New function.
(setFileEntriesToDownload): New function.
(getCompletedLength): New function.
(getPartialTotalLength): New function.
* src/TorrentMan.cc (readFileEntry): New function.
(setup): Use readFileEntry. If no-preallocation option is
specified,
use DefaultDiskWriter.
(readFileEntryFromMetaInfoFile): New function.
(fixFilename): Removed const qualifier.
(splitMultiFile): Removed const qualifier.
(setFileEntriesToDownload): New function.
(isPartialDownloadingMode): New function.
(finishPartialDownloadingMode): New function.
(getCompletedLength): New function.
(getPartialTotalLength): New function.
* src/TorrentConsoleDownloadEngine.h
(partialDownloadLengthDiff):
New variable.
(partialTotalLength): New variable.
(downloadLength): New variable.
(totalLength): New variable.
* src/TorrentConsoleDownloadEngine.cc
(onPartialDownloadingCompletes):
Added log.
(initStatistics): Initialized new variables:
partialDownloadLengthDiff,
partialTotalLength, downloadLength, totalLength.
(calculate): Calculate downloadLength and totalLength.
* src/prefs.h :New definition PREF_NO_PREALLOCATION
* src/main.cc (addCommand): Changed argument signature.
(main): Added new variable: args. Added new option
"torrent-show-files"
"no-preallocation". Usage is not updated yet.
2006-04-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/PeerMessage.cc (setBitfield): Fixed invalid memory
de-allocation.
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
* 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
* CookieBox.cc: rewrited criteriaFind() using Util::startsWith()
and
Util::endsWith().
* SocketCore.cc: struct addrinfo is now zero-initialized.
* common.h: added #include directive of limit.h.
* DownloadEngine.cc: added #include directive of sys/time.h and
algorithm.
* Exception.h: added #include directive of stdio.h.
* AbstractCommand.h: added #include directive of sys/time.h.
* DownloadCommand.h: added #include directive of sys/time.h.
* *.h: added #include directive of common.h to all base classes.
subclasses' one was removed.