Commit Graph

195 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
bca974746a 2008-08-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated Bulgarian and French translations, thanks to all 
translators.
	* po/bg.po
	* po/fr.po
2008-07-31 15:36:46 +00:00
Tatsuhiro Tsujikawa
96498070c6 2008-07-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Reordered src files in POTFILES.in so that usage text appears 
first.
	* po/POTFILES.in
2008-07-23 13:14:17 +00:00
Tatsuhiro Tsujikawa
708a14bf17 2008-07-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added Bulgarian translation.
	Updated Catalan, Spanish, French and Japanese translations.
	Thanks to all translators.
	* po/LINGUAS
	* po/bg.po
	* po/ca.po
	* po/es.po
	* po/fr.po
	* po/ja.po
2008-07-23 13:02:57 +00:00
Tatsuhiro Tsujikawa
0666660f3f 2008-07-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated po files.
	* po/aria2c.pot
	* po/*.po
	* po/*.gmo
2008-07-13 12:22:03 +00:00
Tatsuhiro Tsujikawa
caeb5da8a2 2008-07-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated po files.
	* po/aria2c.pot
	* po/*.po
	* po/*.gmo
2008-07-01 11:41:03 +00:00
Tatsuhiro Tsujikawa
23b6a43585 2008-06-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated po files.
	* po/aria2c.pot
	* po/*.gmo
	* po/*.po
2008-06-25 15:09:56 +00:00
Tatsuhiro Tsujikawa
a8596a8e38 2008-06-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated ja.po
	* src/ja.po
2008-06-20 13:31:38 +00:00
Tatsuhiro Tsujikawa
f55935bd86 2008-06-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated ja.po and fr.po. Great thanks for french translators and
	Sebastien WILLEMIJNS.
	* po/fr.po
	* po/ja.po
2008-06-20 12:19:29 +00:00
Tatsuhiro Tsujikawa
b1c79f5ce5 2008-06-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated po files.
	* po/aria2c.pot
	* po/*.po
	* po/*.gmo
2008-06-16 16:19:23 +00:00
Tatsuhiro Tsujikawa
8f90b6092c 2008-05-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated fr.po(thanks to Sebastien) and ja.po. ThanksDone make 
update-po
	* po/fr.po
	* po/ja.po
	* po/aria2c.pot
	* po/*.po
	* po/*.gmo
2008-05-25 01:43:22 +00:00
Tatsuhiro Tsujikawa
bd19e00919 2008-05-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Done make update-po
	* po/aria2c.pot
	* po/*.po
	* po/*.gmo
2008-05-21 07:59:14 +00:00
Tatsuhiro Tsujikawa
738996932a 2008-05-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Removed the invalid string including '\r' from ru.po and
	did make update-po.
2008-05-15 16:10:25 +00:00
Tatsuhiro Tsujikawa
9d03f0d2f7 2008-05-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated translations. Great thanks to translators.
	* po/ca.po
	* po/de.po
	* po/fr.po
	* po/it.po
	* po/ja.po
	* po/ru.po
	* po/zh_CN.po
2008-05-12 15:39:52 +00:00
Tatsuhiro Tsujikawa
5cc4ca5887 2008-03-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added Simplified Chinese translation. Also updated the following
	translations: Polish, Dutch, German. Great thanks to all 
translators.
2008-03-15 11:05:03 +00:00
Tatsuhiro Tsujikawa
b1aeb277aa 2008-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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}
2008-03-01 04:42:53 +00:00
Tatsuhiro Tsujikawa
6148b08d34 2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated man page and some usage text.
	* doc/aria2c.1.txt
	* src/usage_text.h
	* po/*.{po, gmo}
2008-02-21 14:23:36 +00:00
Tatsuhiro Tsujikawa
465b3bb961 2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated translations. Added Finnish and Hebrew translations.
	Great thanks to all translators!
	* po/*.{po, gmo}
	* po/LINGUAS
2008-02-21 12:46:20 +00:00
Tatsuhiro Tsujikawa
af471b931e 2008-02-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* po/Makefile.in: Removed since this is generated by configure.
2008-02-02 11:28:07 +00:00
Tatsuhiro Tsujikawa
79764a1f11 2008-02-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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.
2008-02-02 04:38:24 +00:00
Tatsuhiro Tsujikawa
fce7b4b32f 2008-01-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added categorized option help. Specify category using --help 
option.
	Also added the ability to search options in forward match.
	* src/HelpItem.{h, cc}
	* test/HelpItemTest.cc
	* src/HelpItemFactory.{h, cc}
	* src/TagContainer.{h, cc}
	* test/TagContainerTest.cc
	* src/option_processing.cc
	* src/prefs.h
	* src/TaggedItem.{h, cc}
	* test/TaggedItemTest.cc
	* src/version_usage.cc
	* src/help_tags.h
	* src/usage_text.h
2008-01-05 11:26:56 +00:00
Tatsuhiro Tsujikawa
ecb0846c34 2007-12-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated translations
	* po/{de,fr,ja,nl,ru}.po
	
	Added Brazilian Portuguese, Catalan, Italian, Spanish, Swedish
	translations. Many thanks to translators.
	* po/{ca,es,it,pt_BR,sv}.po
	* po/LINGUAS
2007-12-08 15:12:42 +00:00
Tatsuhiro Tsujikawa
23a41fba06 2007-11-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated usage
	* src/version_usage.cc

	Updated man page
	* doc/aria2c.1.txt
	* doc/aria2c.1

	Updated po files
	* po/aria2c.pot
	* po/*.po
	* po/*.gmo
2007-11-29 14:22:37 +00:00
Tatsuhiro Tsujikawa
59fb4066fb 2007-11-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/version_usage.cc
	(showVersion): Reworked.
	(showUsage): Added examples.

	Removed Hint for total length and file name.
	* src/Metalink2RequestGroup.cc
	* src/RequestGroup.{h, cc}
	* src/HttpResponseCommand.cc
	* src/FtpNegotiationCommand.cc

	Now --follow-torrent and --follow-metalink option work properly.
	* src/RequestGroup.cc

	Updated man page
	* doc/aria2c.1.txt
	* doc/aria2c.1
2007-11-18 11:59:42 +00:00
Tatsuhiro Tsujikawa
ddefccd03c 2007-11-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed typo.
	* src/version_usage.cc
2007-11-17 14:05:50 +00:00
Tatsuhiro Tsujikawa
ab8c0aafeb 2007-11-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented. Now -c option works fine.
	* src/DefaultPieceStorage.cc (markPiecesDone)
	* test/DefaultPieceStorageTest.cc

	Removed.
	* src/SegmentMan.{h, cc}
	(markAllPiecesDone)
	(markPieceDone)

	Synchronized po files with 
	https://translations.launchpad.net/aria2/trunk/+pots/aria2c
	* src/fr.po
	* src/ru.po
	* src/de.po
	* src/ja.po
2007-11-17 13:49:36 +00:00
Tatsuhiro Tsujikawa
d8ae699182 2007-11-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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
2007-11-04 12:26:12 +00:00
Tatsuhiro Tsujikawa
8b27671e58 2007-10-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use File::renameTo()
	* src/DefaultBtProgressInfoFile.cc

	Added --no-file-allocation-limit command-line option.
        * src/version_usage.cc
	* src/option_processing.cc
        * src/OptionHandlerFactory.cc
        * src/RequestGroup.{h, cc}
	* src/BtCheckIntegrityEntry.cc
	* src/StreamCheckIntegrityEntry.cc
        * src/prefs.h
        * doc/aria2c.1.txt
        * doc/aria2c.1

	Now prealloc is the default value for --file-allocation option.
        * src/version_usage.cc
	* src/option_processing.cc
        * doc/aria2c.1.txt
        * doc/aria2c.1

	Don't URL-encode user-agent.
	* src/HttpRequest.cc

	Updated translations
        * po/LINGUAS: Added nl for Dutch translation.
        * po/nl.po: Added Dutch translation, thanks to A. Bram Neijt.
        * po/de.po: Updated German translation, thanks to Patrick 
Ruckstuhl.
	* po/POTFILES.in: Updated.
2007-10-29 12:43:45 +00:00
Tatsuhiro Tsujikawa
048a2cf597 2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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.
2007-10-11 16:58:24 +00:00
Tatsuhiro Tsujikawa
295c36c767 2007-09-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated man page.
	* doc/aria2c.1.txt
	
	* Release 0.11.3
2007-09-09 16:17:35 +00:00
Tatsuhiro Tsujikawa
2ea9ef9f1e 2007-09-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated fr.po by sebone
	* po/fr.po
2007-09-09 04:49:14 +00:00
Tatsuhiro Tsujikawa
9c1bef16c2 2007-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Updated man page.
	* doc/aria2.1.txt
	
	* Release 0.11.3-rc
2007-09-03 14:17:10 +00:00
Tatsuhiro Tsujikawa
6ce850e580 2007-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Disable parameterized URI support by default. Added -P option to
	enable the feature.
	* src/prefs.h: Added PREF_PARAMETERIZED_URI
	* src/OptionHandlerFactory.cc
	* src/main.cc: Also updated usages for -Z and 
--auto-file-renaming

	Updated Japanese translation.
	* po/ja.po
2007-09-03 11:43:28 +00:00
Tatsuhiro Tsujikawa
f62a1dff8a Update po 2007-08-28 15:47:30 +00:00
Tatsuhiro Tsujikawa
7fb4336d5e 2007-08-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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)
2007-08-28 11:51:20 +00:00
Tatsuhiro Tsujikawa
657a40935e 2007-08-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Avoid sparse files if possible, because VFAT32 doesn't support 
it.
	* src/DefaultDiskWriter.cc (initAndOpenFile)

	Fixed the bug that prevents file allocation is not done when
	dowloading multi-torrent file.
	* src/AbstractDiskWriter.cc (openFile)
	
	Increase the maximum number of -j option from 15 to 45.
	* src/OptionHandlerFactory.cc (createOptionHandlers)

	Added fr.po, thanks to Charles Landemaine.
	* po/fr.po
	* po/LINGUAS
2007-08-18 10:08:47 +00:00
Tatsuhiro Tsujikawa
0ac4dc1e08 2007-08-09 16:04:31 +00:00
Tatsuhiro Tsujikawa
49ddebd684 Updated ja.po 2007-08-09 15:09:50 +00:00
Tatsuhiro Tsujikawa
45f949c713 Updated po files 2007-08-04 15:17:21 +00:00
Tatsuhiro Tsujikawa
8ca716529d Update ja.po 2007-07-23 14:54:24 +00:00
Tatsuhiro Tsujikawa
8d84d9f97c Update ja.po 2007-07-23 13:08:14 +00:00
Tatsuhiro Tsujikawa
cd6b6e3591 2007-07-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that prevents cookies from being sent to the 
server
	if the domain of cookie is FQDN and starts with ".".
	* src/Cookie.cc (match)

	To add the ability to change peer id.
	* src/DefaultBtContext.h
	(_peerIdPrefix): New variable
	(setPeerIdPrefix): New function.
	* src/torrentRequestInfo.cc
	(execute): Set the option value of PREF_PEER_ID_PREFIX to
	DefaultBtContext.
	* src/main.cc (main): Added peer-id-prefix command-line option.
	The usage message is not added yet.
	* src/DefaultBtContext.cc
	(generatePeerId): Use _peerIdPrefix.
	* src/prefs.h (PREF_PEER_ID_PREFIX): New definition.
2007-07-20 17:06:21 +00:00
Tatsuhiro Tsujikawa
18480a08df Updated po files 2007-07-10 00:05:16 +00:00
Tatsuhiro Tsujikawa
583f6c9c22 2007-07-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fix the bug that causes -s option not to work.
	* src/main.cc (main)
	* src/a2algo.h: New file.
2007-07-02 12:40:40 +00:00
Tatsuhiro Tsujikawa
be9dec8535 Updated po files 2007-06-12 10:53:46 +00:00
Tatsuhiro Tsujikawa
db41dfac20 Updated po files 2007-06-10 08:42:15 +00:00
Tatsuhiro Tsujikawa
2d522cf6b7 2007-06-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added -j command-line option.
	* src/OptionHandlerFactory.cc (createOptionHandlers)
	* src/main.cc

	* src/ByteArrayDiskWriter.h, src/ByteArrayDiskWriter.cc
	Rewritten using stringstream.
	* src/TrackerUpdateCommand.h, src/TrackerUpdateCommand.cc
	Rewritten using stringstream.
2007-06-09 10:06:53 +00:00
Tatsuhiro Tsujikawa
5377be3680 Updated to 0.10.2+1 2007-03-29 11:31:15 +00:00
Tatsuhiro Tsujikawa
24d199632b 2007-03-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To cache resolved hostname:
	* src/AbstractCommand.h, src/AbstractCommand.cc
	(resolveHostname): Put outside #ifdef ENABLE_ASYNC_DNS clause.
	Added dns cache.
	* src/FtpInitiateConnectionCommand.cc
	(executeInternal): Removed #ifdef ENABLE_ASYNC_DNS.
	* src/NameResolver.h, src/NameResolver.cc: Added synchronized
	NameResolver working without ares.
	* src/TorrentRequestInfo.cc
	(execute): Don't cache dns in torrent download.
	* src/HttpInitiateConnectionCommand.cc
	(executeInternal): Removed #ifdef ENABLE_ASYNC_DNS
	* src/DNSCache.h: New class.
	* src/UrlRequestInfo.cc
	(execute): Use dns cache
2007-03-28 15:08:22 +00:00
Tatsuhiro Tsujikawa
113c8fac7f 2007-03-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To reduce overhead to find commands whose socket is either
	readable or writable in the download engine loop:
	* src/Command.h, src/Command.cc
	(STATUS): New enum.
	(status): New variable.
	(statusMatch): New function.
	(setStatusActive): New function.
	(setStatusInactive): New function.
	* src/DownloadEngine.h, src/DownloadEngine.cc
	(executeCommand): New function.
	(run): Simplified.
	(waitData): Call Command::setStatusActive() when command's 
socket is
	readable or writable.
2007-03-16 14:21:29 +00:00
Tatsuhiro Tsujikawa
77a05c00b1 2007-01-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To fix segfault in Metalink download:
	
	* src/UrlRequestInfo.h
	(filename): Removed.
	(totalLength): Removed.
	(setTotalLength): Removed.
	(setFilename): Removed.
	* src/MetalinkRequestInfo.cc
	(execute): Do not set filename and totalLength to reqInfo.
	Set chunk checksum to reqInfo if it is not null.
	
	* src/HttpResponseCommand.cc
	(executeInternal): Fixed filename in log.
	(handleDefaultEncoding): Removed the call to initBitfield() and
	markAllPiecesDone().
	(handleOtherEncoding): Added HEAD method handling.
	
	* src/FtpNegotiateCommand.cc
	(executeInternal): Added SEQ_HEAD_OK handling.
	(recvSize): In HEAD handling, set sequence to SEQ_HEAD_OK and
	return false.
	
	* src/FtpNegotiateCommand.h
	(SEQ_HEAD_OK): New definition.
	
	* src/SegmentMan.cc
	(initBitfield): Delete bitfield.
	(isChunkChecksumValidationReady): Fixed the condition.

	* src/UrlRequestInfo.cc: Fixed so that Metalink and Torrent 
download
	works fine.
2007-01-29 16:46:48 +00:00
Tatsuhiro Tsujikawa
2ab41c4f17 2007-01-28 15:11:00 +00:00
Tatsuhiro Tsujikawa
cd91e2ea4f 2007-01-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2007-01-28 14:18:35 +00:00
Tatsuhiro Tsujikawa
e8034f2fd4 Update po files. 2007-01-08 00:19:15 +00:00
Tatsuhiro Tsujikawa
3c1ecc7d30 2006-11-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Introduce new preference PREF_BT_TIMEOUT. This is the timeout 
value
	for BitTorrent download.

	* src/PeerAbstractCommand.cc
	(PeerAbstractCommand): PREF_TIMEOUT -> PREF_BT_TIMEOUT
	* src/main.cc: 
	(timeoutSpecified): Removed.
	(main): Set the initial value of PREF_BT_TIMEOUT to 180.
	Removed timeoutSpecified. TODO: Add --bt-timeout command line 
option.
	* src/TorrentRequestInfo.cc
	(timeoutSpecified): Removed.
	(torrentHandler): Removed timeoutSpecified and the change of 
timeout
	value.
	* src/prefs.h
	(PREF_BT_TIMEOUT): New definition.
	
	Delete unused variables.
	
	* src/TorrentRequestInfo.cc
	(requestInfo): Removed.
2006-11-09 13:51:36 +00:00
Tatsuhiro Tsujikawa
8d0ef717e1 2006-11-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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.
2006-11-08 16:25:38 +00:00
Tatsuhiro Tsujikawa
45463f935f 2006-11-05 15:12:36 +00:00
Tatsuhiro Tsujikawa
c0fd1fff2a 2006-10-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Request -> RequestHandle:
	
	* src/HttpResponseCommand.h: Request->RequestHandle
	* src/AbstractCommand.cc: Request->RequestHandle
	* src/HttpDownloadCommand.cc: Request->RequestHandle
	* src/HttpRequestCommand.cc: Request->RequestHandle
	* src/FtpInitiateConnectionCommand.h: Request->RequestHandle
	* src/AbstractCommand.h: Request->RequestHandle
	* src/HttpProxyRequestCommand.h: Request->RequestHandle
	* src/HttpResponseCommand.cc: Request->RequestHandle
	* src/HttpInitiateConnectionCommand.h: Request->RequestHandle
	* src/FtpNegotiateCommand.cc: Request->RequestHandle
	* src/FtpTunnelResponseCommand.h: Request->RequestHandle
	* src/HttpConnection.h: Request->RequestHandle
	* src/HttpProxyResponseCommand.cc: Request->RequestHandle
	* src/InitiateConnectionCommandFactory.h: Request->RequestHandle
	* src/FtpTunnelResponseCommand.cc: Request->RequestHandle
	* src/DownloadCommand.h: Request->RequestHandle
	* src/FtpDowndloadCommand.cc: Request->RequestHandle
	* src/HttpInitiateConnectionCommand.cc: Request->RequestHandle
	* src/HttpRequestCommand.h: Request->RequestHandle
	* src/FtpNegotiateCommand.h: Request->RequestHandle
	* src/FtpTunnelResponseCommand.cc: Request->RequestHandle
	* src/FtpInitiateConnectionCommand.cc: Request->RequestHandle
	* src/HttpDownloadCommand.h: Request->RequestHandle
	* src/FtpConnection.cc: Request->RequestHandle
	* src/InitiateConnectionCommandFactory.cc: 
Request->RequestHandle
	* src/UrlRequestInfo.cc: Request->RequestHandle
	* src/HttpProxyResponseCommand.h: Request->RequestHandle
	* src/HttpConnection.h: Request->RequestHandle
	* src/DownloadCommand.cc: Request->RequestHandle
	* src/FtpConnection.h: Request->RequestHandle
	* src/FtpDowndloadCommand.h: Request->RequestHandle
	* src/HttpProxyRequestCommand.cc: Request->RequestHandle
	* src/FtpTunnelRequestCommand.h: Request->RequestHandle
	* src/Request.h
	(SharedHandle.h): New include.
	(RequestHandle): New type definition.
	(Requests): Redefined.
	
	To add MULTITRACKER support:

	* src/TrackerWatcherCommand.h
	(createRequestCommand): New function.
	* src/DownloadEngineFactory.cc
	(newTorrentConsoleEngine): Removed req.
	* src/prefs.h
	(PREF_TRACKER_MAX_TRIES): New definition.
	* src/TorrentMan.cc
	(TorrentMan): Removed req. Added trackerNumTry.
	(~TorrentMan): Removed req.
	(setupInternal1): Added announceList.
	* src/TorrentRequestInfo.cc
	(execute): Set PREF_MAX_TIRES to 1. The max number of tries for
	announces is now specified by PREF_TRACKER_MAX_TRIES.
	* src/main.cc
	(main): Added PREF_TRACKER_MAX_TRIES.
	* src/TorrentMan.h
	(Request.h): Removed.
	(AnnounceList.h): New include.
	(trackerNumTry): New variable.
	(req): Removed.
	(announceList): New variable.
	* src/TrackerWatcherCommand.cc
	(execute): Rewritten.
	(createRequestCommand): New function.
	* src/TrackerUpdateCommand.cc
	(execute): Updated with the use of AnnounceList.
	* src/AnnounceList.cc: New class.
	* src/AnnounceList.h: New class.
	
	To fix typo:

	* src/prefs.h
	(PREF_MAX_TRIES): max_try->max_tries

	To not to decode "+" as space in URL decode:

	* src/Util.cc
	(urldecode): Removed "+"->space decoding rule. Test case was 
updated.
2006-10-18 14:57:00 +00:00
Tatsuhiro Tsujikawa
d354e48441 Added man page 2006-10-01 14:11:29 +00:00
Tatsuhiro Tsujikawa
d10b0f36dc 2006-09-23 12:27:16 +00:00
Tatsuhiro Tsujikawa
93ff03c9e3 2006-09-23 12:06:58 +00:00
Tatsuhiro Tsujikawa
65e0ffe6ca 2006-09-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/AbstractCommand.cc
	(execute): Check whether the download has finished before 
checking
	socket status.
	Return true if peerStat->getStatus() == REQUEST_IDLE.
	Do not exit even if no segment is available.

	* src/prefs.h
	(PREF_STARTUP_IDLE_TIME): New definition.

	* src/PeerInteractionCommand.cc
	(executeInternal): Removed max speed limit. Because it performs 
bad.
	(receiveMessages): Added max speed limit. This was better than 
above,
	but still a little bit to be desired. Sometimes the download 
speed
	became much faster than I specified.

	* src/SpeedCalc.h
	(start): New variable.
	(accumulatedLength): New variable.
	(getAvgSpeed): New function.
	* src/SpeedCalc.cc
	(reset): Added start, accumulatedLength.
	(update): Added calculation of an average speed.
	(getAvgSpeed): New function.

	* src/DownloadCommand.h
	(sw): Removed.

	* src/main.cc
	(main): Added PREF_STARTUP_IDLE_TIME.

	* src/PeerStat.h
	(STATUS): Added REQUEST_IDLE.
	(getMaxSpeed): Renamed as getMaxDownloadSpeed().
	(getAvgDownloadSpeed): New function
	(requestIdle): New function.

	* src/SegmentMan.h
	(SegmentEntryHandle): New type definition.
	(SegmentEntries): Now holds SegmentEntryHandle.
	(findSlowerSegmentEntry): New funtion.
	* src/SegmentMan.cc
	(save): Updated according to the changes in SegmentEntries.
	(read): Updated according to the changes in SegmentEntries.
	(FindSegmentEntryByIndex): Updated according to the changes in
	SegmentEntries.
	(FindSegmentEntryByCuid): Updated according to the changes in
	SegmentEntries.
	(checkoutSegment): Updated according to the changes in 
SegmentEntries.
	(onNullBitfield): Updated according to the changes in 
SegmentEntries.
	Renamed uitr as itr.
	(findSlowerSegmentEntry): New function.
	(getSegment): Updated according to the changes in 
SegmentEntries.
	Added the feature that cancels the segment with slow server and 
fast
	one takes it over.
	(cancelSegment): Updated according to the changes in 
SegmentEntries.
	(getDownloadLength): Updated according to the changes in
	SegmentEntries.
	(init): Assigned 0 to bitfield after deleting it.
	
	* src/DownloadCommand.cc
	(STARTUP_IDLE_TIME): Removed.
	(executeInternal): Use PREF_STARTUP_IDLE_TIME.
2006-09-21 06:56:54 +00:00
Tatsuhiro Tsujikawa
1d52ba244e 2006-08-28 15:40:50 +00:00
Tatsuhiro Tsujikawa
e9f907fe1e 2006-08-21 15:04:49 +00:00
Tatsuhiro Tsujikawa
11dc664f83 2006-08-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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
2006-08-14 15:03:38 +00:00
Tatsuhiro Tsujikawa
f2d4faad08 2006-08-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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().
2006-08-11 12:29:55 +00:00
Tatsuhiro Tsujikawa
19d593413c 2006-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* po/ru.po: Azamat sent me Russian translation.
	
	* src/FtpNegotiateCommand.cc
	(recvGreeting): Call disableWriteCheckSocket just after
	socket->setBlockingMode(). This avoids unnecessary CPU-hog loop.

	Rename Time.h to TimeA2.h to avoid compilation ploblem on
	case-insesitive filesystem(BUG#1531057).

	* src/Time.h: Renamed as TimeA2.h.
	* src/Time.cc: Renamed as TimeA2.cc.
	* src/TimeA2.h: New class.
	* src/TimeA2.cc: New class.
	* src/PeerChokeCommand.h: Replaced Time.h with TimeA2.h.
	* src/TrackerWatcherCommand.h: Replaced Time.h with TimeA2.h.
	* src/PeerAbstractCommand.h: Replaced Time.h with TimeA2.h.
	* src/AbstractCommand.h: Replaced Time.h with TimeA2.h.
	* src/PeerInteractionCommand.h: Replaced Time.h with TimeA2.h.
	* src/ConsoleDownloadEngine.h: Replaced Time.h with TimeA2.h.
	* src/TorrentAutoSaveCommand.h: Replaced Time.h with TimeA2.h.
	* src/DownloadCommand.h: Replaced Time.h with TimeA2.h.
	* src/TorrentMan.h: Replaced Time.h with TimeA2.h.
	* src/TorrentDownloadEngine.h: Replaced Time.h with TimeA2.h.
	* src/RequestSlot.h: Replaced Time.h with TimeA2.h.
	* src/SleepCommand.h: Replaced Time.h with TimeA2.h.
	* src/DownloadEngine.cc: Replaced Time.h with TimeA2.h.
2006-08-07 16:28:41 +00:00
Tatsuhiro Tsujikawa
58dbaafc85 2006-08-08 Tatsuhiro Tsujikawa <tujikawa@rednoah.com>
* 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.
2006-08-07 16:05:00 +00:00
Tatsuhiro Tsujikawa
941e0108d3 2006-07-20 15:57:25 +00:00
Tatsuhiro Tsujikawa
fac88666ed 2006-07-04 11:47:56 +00:00
Tatsuhiro Tsujikawa
31cf446f6d 2006-07-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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.
2006-07-04 10:57:56 +00:00
Tatsuhiro Tsujikawa
722b3f8957 2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To fix the bug that causes same have message is sent many times 
to
	a single peer.

	* src/Time.cc
	(isNewer): Use Util::difftv().

	To fix the bug that sends tracker requests without a sleep 
interval
	when the number of connections is less than 15.

	* src/TrackerWatcherCommand.cc
	(execute): Now the number of connections is not a factor to 
decide
	whether or not a tracker request should be sent or not.
	* src/Time.h
	(setTimeInSec): New function.
	* src/Time.cc
	(setTimeInSec): New function.

	etc.
	
	* src/ChokeMessage.cc
	(receivedAction): Removed peer->snubbing = false

	* src/PeerConnection.h
	(receiveHandshake): Updated doc.

	* src/TorrentMan.h
	(getAdvertisedPieceIndexes): Updated the method signature.
	* src/TorrentMan.cc
	(getAdvertisedPieceIndexes): Updated the method signature.

	* Release 0.5.2
2006-06-24 16:09:14 +00:00
Tatsuhiro Tsujikawa
d380b7b6ab 2006-06-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add Time class which represents a specific instant in time 
and
	its precision is microseconds. Time checking procedures were 
rewritten
	using this object.

	* src/Time.h: New class.
	* src/Time.cc: New class.
	* src/AbstractCommand.h
	(updateCheckPoint): Removed.
	(isTimeoutDetected): Removed.
	(checkPoint): Changed the type to Time.
	(timeout): New variable.
	(setTimeout): New function.
	* src/AbstractCommand.cc
	(AbstractCommand): Removed the initialization of checkPoint.
	Added the initialization of timeout.
	(updateCheckPoint): Removed.
	(isTimeoutDetected): Removed.
	(execute): Use checkPoint.reset() and checkPoint.elapsed().
	* src/PeerChokeCommand.h
	(checkPoint): Changed the type to Time.
	* src/PeerChokeCommand.cc
	(PeerChokeCommand): Removed the initialization of checkPoint.
	(execute): Rewritten using Time object.
	* src/TrackerWatcherCommand.h
	(checkPoint): Changed the type to Time.
	* src/TrackerWatcherCommand.cc
	(TrackerWatcherCommand): Removed the initialization of 
checkPoint.
	(execute): Rewritten.
	* src/ConsoleDownloadEngine.h
	(cp): Changed the type to Time.
	(startup): Changed the type to Time.
	* src/ConsoleDownloadEngine.cc
	(initStatistics): Use cp.reset(), startup.reset().
	(calculateStatistics): Rewritten using Time object.
	* src/PeerAbstractCommand.h
	(updateCheckPoint): Removed.
	(isTimeoutDetected): Removed.
	(checkPoint): Changed the type to Time.
	* src/PeerAbstractCommand.cc
	(PeerAbstractCommand): Removed the initialization of checkPoint.
	(updateCheckPoint): Removed.
	(isTimeoutDetected): Removed.
	(execute): Use checkPoint.reset() and checkPoint.elapsed().
	* src/PeerInteractionCommand.cc
	(PeerInteractionCommand): Removed the initializations of struct
	timeval variables.
	* src/PeerInteractionCommand.h
	(keepAliveCheckPoint): Changed the type to Time.
	(chokeCheckPoint): Changed the type to Time.
	(freqCheckPoint): Changed the type to Time.
	(haveCheckTime): Changed the type to Time.
	* src/PeerInteractionCommand.cc
	(executeInternal): Rewritten using Time object.
	(detectMessageFlooding): Rewritten using Time object.
	(checkLongTimePeerChoking): Rewritten using Time object.
	(sendKeepAlive): Rewritten using Time object.
	(checkHave): Rewritten using Time object.
	* src/SleepCommand.h
	(checkPoint): Changed the type to Time.
	* src/SleepCommand.cc
	(SleepCommand): Removed the initialization of checkPoint.
	(execute): Rewritten using Time object.
	* src/TorrentAutoSaveCommand.h
	(checkPoint): Changed the type to Time.
	* src/TorrentAutoSaveCommand.cc
	(TorrentAutoSaveCommand): Removed the initialization of 
checkPoint.
	(execute): Rewritten.
	* src/DownloadCommand.h
	(sw): Changed the type to Time.
	* src/DownloadCommand.cc
	(DownloadCommand): Removed the initialization of sw.
	(executeInternal): Rewritten.
	* src/RequestSlot.h
	(dispatchedTime): Changed the type to Time.
	* src/RequestSlot.cc
	(RequestSlot): Removed the call to setDispatchedTime().
	(setDispatchedTime): Rewirtten.
	(isTimeout): Rewritten.
	(getLatencyInMillis): Rewritten.
	* src/TorrentDownloadEngine.h
	(cp): Changed the type to Time[2].
	(startup): Changed the type to Time.
	* src/TorrentDownloadEngine.cc
	(initStatistics): Rewritten.
	(calculateStatistics): Rewritten.
	* src/DownloadEngine.cc
	(run): Rewritten.
	
	To detect all attempts to connect to the tracker are failed:

	* src/AbstractCommand.cc
	(execute): Increment e->segmentMan->errors if a command aborted.
	* src/SegmentMan.h
	(errors): New variable.
	* src/SegmentMan.cc
	(SegmentMan): Added the initialization of errors.
	(init): Added the initialization of errors.
	* src/TrackerWatcherCommand.cc
	(execute): If e->segmentMan->errors > 0 then assume that the 
tracker
	request was failed.
	
	To handle snubbed peers:
	
	* src/PeerChokeCommand.cc
	(optUnchokingPeer): Snubbed peers don't get unchoked.
	(execute): Snubbed peers don't get unchoked.
	* src/PeerInteraction.h
	(REQUEST_TIME_OUT): Changed the value from 120 to 60.
	* src/PeerInteraction.cc
	(checkRequestSlot): A peer get marked as "snubbed" if it doesn't 
send
	back the requested 16k block in 60 seconds.
	* src/PieceMessage.cc
	(receivedAction): A peer's snubbed state is cleard if it sends
	the requested 16k block in 60 seconds.
	* src/Peer.h
	(snubbing): New variable.
	* src/Peer.cc
	(resetStatus): Added snubbed = false.
	
	To fix the bug that causes have message is not sent:

	* src/PeerInteractionCommand.cc
	(~PeerInteractionCommand): Removed 
e->torrentMan->unadvertisePiece().
	(FLOODING_CHECK_INTERVAL): New definition(temporal).
	(detectMessageFlooding): Use FLOODING_CHECK_INTERVAL.
	* src/TorrentMan.h
	(HaveEntry): New class.
	(advertisePiece): Rewritten.
	(getAdvertisedPieceIndexes): Rewritten.
	(Haves): Changed the type.
	(getAdvertisedPieceIndexes): Added an argument.
	
	Others:
	
	* src/TorrentMan.h
	(DEFAULT_ANNOUNCE_INTERVAL): Changed the value to 1800.
	(DEFAULT_ANNOUNCE_MIN_INTERVAL): Changed the value to 1800.
	* src/TorrentMan.cc
	(getPeer): Don't check the number of connections here.
	(setupInternal1): Changed peerId.

	* src/PeerInteractionCommand.h
	(KEEP_ALIVE_INTERVAL): New definition.
	(sendKeepAlive): Use KEEP_ALIVE_INTERVAL.

	* src/main.cc
	(main): SA_ONESHOT was replaced with SA_RESETHAND.

	* src/DownloadEngine.h: Removed unnecessary header includes.
2006-06-12 16:55:08 +00:00
Tatsuhiro Tsujikawa
ca5e332df9 2006-05-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/PeerAbstractCommand.h
	(beforeSocketCheck): Removed.
	* src/PeerAbstractCommand.cc
	Modified in order to call executeInternal() even if socket check
	and upload limit check fail.
	* src/PeerInteractionCommand.h
	(keepAlive): Removed.
	(sendKeepAlive): New function.
	(checkHave): New function.
	(beforeSocketCheck): Removed.
	* src/PeerInteractionCommand.cc
	(executeInternal): Use peerInteraction->checkRequestSlot(). 
Added
	calls to checkHave() and sendKeepAlive().
	(keepAlive): Renamed to sendKeepAlive().
	(sendKeepAlive): New function.
	(beforeSocketCheck): Removed.
	(checkHave): New function.
	* src/BitfieldMan.cc
	(getMissingIndex): Don't call getMissingIndexRandomly() if max 
is 0.
	(getMissingUnusedIndex): Don't call getMissingIndexRandomly() if 
max is
	0.
	(getMissingIndex): Dont't call getMissingIndexRandomly() if max 
is 0.
	* src/TorrentMan.h
	(UsedPieces): Removed.
	(Pieces): New type definition.
	* src/Piece.h: Updated doc.
	* src/Peer.h
	(totalLength): Removed.
	* src/Peer.cc
	(updateLatency): Fixed the latency calculation.
	* src/TorrentMan.cc
	(addPeer): Call deleteOldErrorPeers() only if peers.size() is 
higher
	than or equal to MAX_PEER_LIST_SIZE.
	If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
	then return false.
	(deleteOldErrorPeers): Rewritten.
	(deleteUsedPiece): Fixed the miss use of STL remove.
	* src/PeerInteraction.h
	(Pieces): Removed.
	(deleteTimeoutRequestSlot): Removed.
	(deleteCompletedRequestSlot): Removed.
	(checkRequestSlot): New function.
	* src/PeerInteraction.cc
	(deleteTimeoutRequestSlot): Merged to checkRequestSlot().
	(deleteCompletedRequestSlot): Merged to checkRequestSlot().
	(checkRequestSlot): New function.
	* src/DownloadEngine.cc
	(run): Clear activeSockets before calling waitData().
	(waitData): Removed a call to activeSockets.clear().
2006-05-26 15:28:19 +00:00
Tatsuhiro Tsujikawa
ebfdbefb7f 2006-05-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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.
2006-05-09 15:54:14 +00:00
Tatsuhiro Tsujikawa
500e978628 * src/main.cc (main): Fixed typo.
* src/message.h: Fixed typo.

	* po/de.po: Added German translation, thanks to Hermann J. 
Beckers.
2006-05-06 01:08:42 +00:00
Tatsuhiro Tsujikawa
75deb4e605 2006-04-29 17:41:49 +00:00
Tatsuhiro Tsujikawa
15b207a53e * src/SocketCore.cc
(writeData): Removed timeout argument.
	(readData): Removed timeout argument.
	(peekData): Removed timeout argument.
	* src/Socket.cc
	(writeData): Removed timeout argument.
	(readData): Removed timeout argument.
	(peekData): Removed timeout argument.
2006-04-29 11:23:39 +00:00
Tatsuhiro Tsujikawa
df2364b1db 2006-04-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add --select-file command-line option:
	
	* src/Util.cc
	(unfoldRange): New function.
	(getNum): New function.
	(unfoldSubRange): New function
	* src/main.cc
	(showUsage): Added help message.
	(main): Added --select-file command-line option.
	
2006-04-28  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>

	To deploy upload rate based choking algorithm:
	
	* src/PeerInteractionCommand.cc
	(PeerInteractionCommand): Add peer to TorrentMan::activePeers to 
track
	peer currently used.
	(decideChoking): Deleted the choke/unchoke decision algorithm 
when
	download completes. Simplified.
	(receiveMessage): Updated.
	* src/TorrentMan.h
	(activePeers): New variable.
	(addActivePeer): New function.
	(getActivePeers): New function.
	(deleteActivePeer): New function.
	* src/TorrentMan.cc
	(addPeer): deleteOldErrorPeers is moved to the begining of the 
function
	* src/PeerAbstractCommand.cc
	(onAbort): Use peer->resetStatus().
	* src/main.cc
	(PeerChokeCommand.h): Included.
	(main): Added the instance of ChokingCommand to the command 
queue.
	* src/Peer.h
	(amChoking): Renamed from amChocking
	(chokingRequired): New variable.
	(optUnchoking): New variable.
	(deltaUpload): New variable.
	(deltaDownload): New variable.
	(addDeltaUpload): New function.
	(resetDeltaUpload): New function.
	(addDeltaDownload): New function.
	(resetDeltaDownload): New function.
	(addPeerUpload): Added a call to addDeltaUpload.
	(addPeerDownload): Added a call to addDeltaDownload.
	* src/Peer.cc
	(shouldBeChoking): Renamed from shouldChoke.
	(resetStatus): New function.
	* src/PeerChokeCommand.h: New class.
	* src/PeerChokeCommand.cc: New class.
	
	To add lazy upload speed limiter:

	* src/TorrentConsoleDownloadEngine.h: Moved the variables for
	statistics calculation to TorrentDownloadEngine.
	* src/TorrentConsoleDownloadEngine.cc
	(sendStatistics): Renamed from printStatistics.
	(initStatistics): Removed. Moved to TorrentDownloadEngine.
	(calculateSpeed): Removed. Moved to TorrentDownloadEngine.
	(calculateStatistics): Removed. Moved to TorrentDownloadEngine.
	* src/TorrentDownloadEngine.h: Added the variables for 
statistics
	calculation.
	(sendStatistics): New function as pure virtual function.
	(getUploadSpeed): New function.
	* src/TorrentDownloadEngine.cc
	(initStatistics): New function.
	(calculateSpeed): New function.
	(calculateStatistics): New function.
	* src/SendMessageQueue.h
	(uploadLength): New variable.
	(send): Added an argument.
	(setUploadLimit): New function.
	(getUploadLimit): New function.
	* src/SendMessageQueue.cc
	(send): Added upload speed limiter.
	* src/prefs.h
	(PREF_UPLOAD_LIMIT): New definition.
	* src/PeerInteractionCommand.cc
	(PeerInteractionCommand): Set upload speed limit to 
sendMessageQueue.
	* src/main.cc
	(main): Added --upload-limit option

	For bug fixes:
	
	* src/main.cc
	(showUsage): Corrected --listen-port help

	Other changes:
	
	* src/TorrentMan.cc
	(getPeer): Return nullPeer if connection is grather than
	MAX_PEER_UPDATE(15) in order to leave space for incoming peers.
2006-04-28 15:55:11 +00:00
Tatsuhiro Tsujikawa
e6bf2338cf 2006-04-21 13:04:02 +00:00
Tatsuhiro Tsujikawa
5067ad8d48 2006-04-20 16:09:15 +00:00
Tatsuhiro Tsujikawa
536c07488b To add some useful information to the exception message:
* src/SocketCore.cc : Updated messages.
	* src/SegmentMan.cc : 
	* src/TorrentMan.cc : Updated messages.
	* src/MultiDiskWriter.cc : Updated messages.
	* src/Util.cc : Updated messages.
	* src/AbstractDiskWriter.cc : Updated messages.
	* src/PreAllocationDiskWriter.cc : Updated messages.
	* src/message.cc : Added new messages. Updated some messages.

	* src/TrackerWatcherCommand.h (MIN_PEERS): New definition.
	* src/TrackerWatcherCommand.cc (execute): Use MIN_PEERS.
	Updated threshold from 30 to 15.

	* src/AbstractDiskWriter.h (filename): New variable.
	* src/AbstractDiskWriter.cc (openExistingFile): Assigned 
filename.
	(createFile): Assigned filename.
	
	* src/main.cc: Updated the help message for http-auth-scheme.
2006-04-20 15:58:05 +00:00
Tatsuhiro Tsujikawa
8203364972 2006-04-19 17:49:27 +00:00
Tatsuhiro Tsujikawa
19f713b99d 2006-04-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add a readout of estimated remaining time to normal HTTP/FTP
	downloads:
	
	* src/ConsoleDownloadEngine.h (startup): New variable.
	(startupLength): New variable.
	(isStartupLengthSet): New variable.
	(avgSpeed): New variable.
	(eta): New variable.
	* src/ConsoleDownloadEngine.cc (sendStatistics): Added a readout 
of
	estimated remaining time.
	(initStatistics): Initialized newly added variables.
	(calculateStatistics): Calculate average speed and estimated 
remaining
	time.

	To decouple TorrentDownloadEngine from HttpResponseCommand:

	* src/TrackerDownloadCommand.h: Removed.
	* src/TrackerDownloadCommand.cc: Removed.
	* src/TrackerInitCommand.h: Removed.
	* src/TrackerInitCommand.cc: Removed.
	* src/TrackerUpdateCommand.h: Removed.
	* src/TrackerUpdateCommand.cc: Removed.
	* src/TrackerWatcherCommand.cc (execute): The construction of 
request
	url written in TrackerInitCommand was moved here. Do not create
	tracker request command if torretnMan->trackers != 0.
	* src/CompactTrackerResponseProcessor.h: New class.
	* src/CompactTrackerResponseProcessor.cc: New class.
	* src/message.h (MSG_TRACKER_WARNING_MESSAGE): Updated.
	* src/HttpResponseCommand.cc (createHttpDownloadCommand):
	Decoupled TorrentDownloadEngine from this.
	* src/SegmentMan.h (init): New function.
	* src/SegmentMan.cc (init): New function.
	* src/TorrentMan.h (responseProcessor): New variable.
	(trackers): New variable.
	(setTrackerResponseProcessor): New function.
	(getTrackerResponseProcessor): New function.
	(processTrackerResponse): New function.
	* src/TorrentMan.cc (Constructor): Initialized new variable 
trackers.
	(processTrackerResponse): New function.
	* src/main.cc (main): Use ByteArrayDiskWriter and
	CompactTrackerResponseProcessor.
	* src/TorrentDownloadEngine.cc (afterEachIteration): Call 
torrentMan->
	processTrackerResponse().
	
	* src/TorrentConsoleDownloadEngine.cc (printStatistics): Updated 
a
	readout.

	* src/TorrentDownloadEngine.cc (afterEachIteration): Added log 
message
	which indicates download has completed.

	* src/AbstractDiskWriter.cc (Destructor): fd >= 0, not fd >0
	(closeFile): fd >= 0, not fd > 0

	* src/main.cc (main): Added short cut for show-files.
	Added short cut for torrent-file.
	Added new command-line option listen-port.
	Updated i18n messages.
2006-04-18 17:06:17 +00:00
Tatsuhiro Tsujikawa
58633887e9 2006-04-12 13:56:02 +00:00
Tatsuhiro Tsujikawa
305aad8690 2006-04-06 12:52:47 +00:00
Tatsuhiro Tsujikawa
8cec3f1153 2006-04-01 14:40:36 +00:00
Tatsuhiro Tsujikawa
4892b40945 2006-03-27 14:48:00 +00:00
Tatsuhiro Tsujikawa
2065b049ab * Request.h: Added AFTER_COMPLETED event.
* TorrentDownloadEngine.cc: Prints "Download complete" message
	instead of downloaded size and progress(%) after download 
completes.
	* PeerInteractionCommand.cc: After download completes, sends 
unchoke
	message to the peer if it is interested in what localhost has
	downloaded.
	* TorrentMan.cc: In single-file mode, copy temporary file to the 
final
	destination instead of just renaming it.
	* TorrentMan.cc: Added deleteTempFile().
	* PeerAbstractCommand.cc: do not stop execution after download
	completes. This makes localhost a seeder.
	* Util.{h,cc}: Added fileCopy().
	* PeerListenCommand.cc: do not stop execution after download 
completes.
	This makes localhost a seeder.
	* main.cc: Do not call TorrentMan::fixFilename() in 
torrentHandler.
	Added TorrentMan::deleteTempFile() to torrentHandler.
	Initialized the variable dir as ".".
	* TorrentMan.h: Changed DEFAULT_ANNOUNCE_INTERVAL to 120 
seconds.
	Deleted renameSingleFile().
	Added copySingleFile(), deleteTempFile().
	* DownloadEngine.h: Added virtual function afterEachIteration().
	* TorrentDownloadEngine.cc: Move a call to 
TorrentMan::fixFilename()
	in onEndOfRun() to afterEachIteration().
	In onEndOfRun(), changed if condition to check whether 
filenameFixed is
	true.
	* Util.cc: Implemented fileCopy() using rangedFileCopy().
	In rangedFileCopy(), added try-catch block to properly close 
file
	descriptors.
	* TorrentDownloadEngine.cc: Added a member variable 
filenameFixed.
	Added afterEachIteration(), isFilenameFixed().
	* Peer.cc: Changed choking strategy.
	* PreAllocationDiskWriter.cc: Drop O_DIRECT flag.
	* TrackerInitCommand.cc: Send completed event only once.
	* DownloadEngine.cc: Added a call to afterEachIteration().
	* TrackerUpdateCommand.cc: Do not stop execution after download
	completes.
	* TorrentMan.h: Defined MAX_PEER_UPDATE as 15. aria2 attempts to
	connect the peers at most MAX_PEER_UPDATE when a peer list is
	received from a tracker.
	* TrackerUpdateCommand.cc: Implemented above mentioned behavior.
	Decreased the number of failure peers to delete to 0(just 
comment out
	the line).
	* Release 0.3.1
2006-03-24 11:59:18 +00:00
Tatsuhiro Tsujikawa
1fcd640d3b * AbstractCommand.cc: casted timeout value to long long int.
* ChunkedEncoding.cc: fixed memory leak.
	* PeerInteractionCommand.cc: casted timeout value to long long 
int.
	* SleepCommand.cc: casted timeout value to long long int.
	* Data.cc: fixed memory leak.
	* Data.cc: fixed toLLInt().
	* BitfieldMan.cc: fixed memory leak.
	* TorrentMan.cc: initialized storeDir to ".".
	* TorrentMan.cc: fixed memory leak.
	* TorrentMan.cc: corrected file paths of splitted files.
	* PeerAbstractCommand.cc: casted timeout to long long int.
	* main.cc: added delete(req) and delete(te->diskWriter).
	* RequestSlot.cc: casted timeout value to long long int.
	* Request.cc: fixed memory leak.
	* PendingMessage.cc: make HAVE messages sent only when peer does 
not
	have the piece.
	* Peer.{h,cc}: added hasPiece(int index).
2006-03-23 10:47:25 +00:00
Tatsuhiro Tsujikawa
01118364a5 2006-03-21 16:07:22 +00:00
Tatsuhiro Tsujikawa
df6c7c0385 added bittorrent support(experimental) 2006-03-21 14:12:51 +00:00
Tatsuhiro Tsujikawa
2a1b2c8ab4 2006-03-07 13:58:29 +00:00
Tatsuhiro Tsujikawa
a102282ae6 Deleted m4/Makefile, po/Makefile 2006-03-07 13:52:36 +00:00
Tatsuhiro Tsujikawa
8d980589e3 2006-03-05 06:32:01 +00:00
Tatsuhiro Tsujikawa
0276b3bb37 * DownloadEngine.{h, cc}:
* 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
2006-03-02 10:43:00 +00:00