2006-02-17 13:35:04 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
2006-09-21 15:31:24 +00:00
|
|
|
* aria2 - The high speed download utility
|
2006-02-17 13:35:04 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-09-21 15:31:24 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give
|
|
|
|
* permission to link the code of portions of this program with the
|
|
|
|
* OpenSSL library under certain conditions as described in each
|
|
|
|
* individual source file, and distribute linked combinations
|
|
|
|
* including the two.
|
|
|
|
* You must obey the GNU General Public License in all respects
|
|
|
|
* for all of the code used other than OpenSSL. If you modify
|
|
|
|
* file(s) with this exception, you may extend this exception to your
|
|
|
|
* version of the file(s), but you are not obligated to do so. If you
|
|
|
|
* do not wish to do so, delete this exception statement from your
|
|
|
|
* version. If you delete this exception statement from all source
|
|
|
|
* files in the program, then also delete it here.
|
2006-02-17 13:35:04 +00:00
|
|
|
*/
|
|
|
|
/* copyright --> */
|
|
|
|
#include "HttpInitiateConnectionCommand.h"
|
2006-03-02 02:54:49 +00:00
|
|
|
#include "ConsoleDownloadEngine.h"
|
2006-02-17 13:35:04 +00:00
|
|
|
#include "SegmentMan.h"
|
2006-04-17 16:17:20 +00:00
|
|
|
#include "LogFactory.h"
|
2006-02-17 13:35:04 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "DefaultDiskWriter.h"
|
|
|
|
#include "Util.h"
|
|
|
|
#include "InitiateConnectionCommandFactory.h"
|
2006-02-21 14:00:58 +00:00
|
|
|
#include "prefs.h"
|
2006-07-30 12:58:27 +00:00
|
|
|
#include "FeatureConfig.h"
|
2006-08-07 16:05:00 +00:00
|
|
|
#include "DownloadEngineFactory.h"
|
|
|
|
#include "UrlRequestInfo.h"
|
|
|
|
#include "TorrentRequestInfo.h"
|
2006-03-22 16:21:11 +00:00
|
|
|
#include <deque>
|
2006-02-17 13:35:04 +00:00
|
|
|
#include <algorithm>
|
2006-03-21 14:12:51 +00:00
|
|
|
#include <time.h>
|
2006-02-17 13:35:04 +00:00
|
|
|
#include <signal.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <libgen.h>
|
|
|
|
#include <utility>
|
|
|
|
extern char* optarg;
|
|
|
|
extern int optind, opterr, optopt;
|
|
|
|
#include <getopt.h>
|
|
|
|
|
2006-08-21 13:31:49 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
#include "MetalinkRequestInfo.h"
|
|
|
|
#include "Xml2MetalinkProcessor.h"
|
|
|
|
#endif
|
|
|
|
|
2006-02-17 18:51:12 +00:00
|
|
|
#ifdef HAVE_LIBSSL
|
|
|
|
// for SSL
|
|
|
|
# include <openssl/err.h>
|
|
|
|
# include <openssl/ssl.h>
|
|
|
|
#endif // HAVE_LIBSSL
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
# include <gnutls/gnutls.h>
|
|
|
|
#endif // HAVE_LIBGNUTLS
|
2006-02-17 18:51:12 +00:00
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
RequestInfo* requestInfo;
|
* src/PeerChokeCommand.cc
(optUnchokingPeer): Updated according to the changes in Peer.
(ResetDelta): Removed.
(UploadFaster): Updated according to the changes in Peer.
(DownloadFaster): Updated according to the changes in Peer.
(execute): I clarify the meaning of "upload" and "download"
here.
"upload" means the transfer from localhost to remote host.
"download" means the transfer from remote host to localhost.
Based on this rule, I swapped orderByUploadRate and
orderByDownloadRate.
* src/PeerInteractionCommand.cc
(PeerInteraction): Removed peerInteraction->setUploadLImit().
(executeInternal): Removed the argument of
peerInteraction->sendMessages().
(receiveMessages): Rewritten download speed limit.
(sendKeepAlive): Removed peerInteraction->sendMessages().
* src/HttpResponseCommand.cc
(handleDefaultEncoding): If file size is unknown in torrent
request,
do not call segmentMan->initBitfield() here.
Disabled persistent connection feature in torrent request.
* src/UrlRequestInfo.h
(UrlRequestInfo): Removed const qualifier from option.
* src/TorrentMan.h
(TransferStat): New class.
(deltaDownloadLength): Removed.
(deltaUploadLength): Removed.
(addDeltaDownloadLength): Removed.
(getDeltaDownloadLength): Removed.
(resetDeltaDownloadLength): Removed.
(addDeltaUploadLength): Removed.
(getDeltaUploadLength): Removed.
(resetDeltaUploadLength): Removed.
(addActivePeer): Added peer->activate().
(deleteActivePeer): Added peer->deactivate().
(calculateStat): New function.
* src/TorrentMan.cc
(TorrentMan): Removed deltaDownloadLength and deltaUploadLength.
(calculateStat): New function.
* src/PeerInteraction.h
(uploadLimit): Removed.
(option): New variable.
(setUploadLimit): Removed.
(getUploadSpeed): Removed.
(sendMessages): Removed the argument "currentUploadSpeed".
* src/PeerInteraction.cc
(prefs.h): Included.
(PeerInteraction): Removed uploadLimit. Added option.
(sendMessages): Rewritten upload speed limit.
(sendHandshake): Removed the argument from sendMessages().
(sendBitfield): Removed the argument from sendMessages().
* src/PeerAbstractCommand.cc
(execute): Commented out the portion of upload limit.
(onAbort): Removed peer->resetStatus().
* src/TorrentRequestInfo.cc
(timeoutSpecified): Declared extern.
(execute): Set timeout to 180 if timeout is not specified by.
command-line.
* src/PieceMessage.cc
(receivedAction): Added peer->updateDownloadLength().
Removed peer->addPeerUpload().
Removed torrentMan->addDeltaDownloadLength().
(send): Added peer->updateUploadLength().
Removed peer->addPeerDownload().
Removed torrentMan->addDeltaUploadLength().
* src/main.cc
(timeoutSpecified): New variable.
(main): Set timeoutSpecified to false.
If the command-line option "--upload-limit" is specified, then
timeoutSpecified is set to true. This option will remain in the
next
release, but be deprecated in the future release.
* src/TorrentRequestInfo.h
(TorrentRequestInfo): Removed const qualifier from op.
* src/PeerStat.h
(uploadSpeed): New variable.
(PeerStat): Added default value to cuid.
(calculateUploadSpeed): New function.
(updateUploadLength): New function.
(getMaxUploadSpeed): New function.
(getAvgUploadSpeed): New function.
(reset): Added uploadSpeed. Set status to IDLE.
* src/TorrentDownloadEngine.h
(cp): Declared as Time.
(sessionDownloadLengthArray): Removed.
(sessionUploadLengthArray): Removed.
(currentCp): Removed.
(lastCalcStat): New variable
(lastElapsed): Removed.
(sessionDownloadLength): Removed.
(calculateStat): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): Removed lastElapsed, cp[],
sessionDownloadLengthArray[], sessionUploadLengthArray[],
currentCp, sessionDownloadLength.
Added cp.reset() and lastCalcStat.reset().
(calculateSpeed): Changed the name of the argument.
(calculateStatistics): Rewritten.
(calculateStat): New function.
* src/Peer.h
(PeerStat.h): Included.
(peerUpload): Removed.
(peerDownload): Removed.
(peerStat): New variable.
(sessionUploadLength): New variable.
(sessionDownloadLength): New variable.
(deltaUpload): Removed.
(deltaDownload): Removed.
(resetStatus): Made private.
(Peer): Added sessionUploadLength, sessionDownloadLength.
Removed peerUpload, peerDownload.
(updateUploadLength): New function.
(addDeltaUpload): Removed.
(updateDownloadLength): New function.
(resetDeltaUpload): Removed.
(getDeltaUpload): Removed.
(addDeltaDownload): Removed.
(calculateUploadSpeed): New function.
(resetDeltaDownload): Removed.
(getDeltaDownload): Removed.
(calculateDownloadSpeed): New function.
(getSessionUploadLength): New function.
(getSessionDownloadLength): New function.
(activate): New function.
(deactivate): New function.
(addPeerUpload): Removed.
(setPeerUpload): Removed.
(getPeerUpload): Removed.
(addPeerDownload): Removed.
(setPeerDownload): Removed.
(getPeerDownload): Removed.
* src/Peer.cc
(resetStatus): Removed resetDeltaUpload() and
resetDeltaDownload().
* src/MetalinkRequestInfo.h
(MetalinkRequestInfo): Removed const qualifier from op.
* src/RequestInfo.h
(op): Removed const qualifier.
(RequestInfo): Removed const qualifier from op.
2006-09-21 13:49:06 +00:00
|
|
|
bool timeoutSpecified;
|
2006-03-21 14:12:51 +00:00
|
|
|
|
2006-05-24 15:18:58 +00:00
|
|
|
void setSignalHander(int signal, void (*handler)(int), int flags) {
|
2006-04-17 14:15:36 +00:00
|
|
|
struct sigaction sigact;
|
|
|
|
sigact.sa_handler = handler;
|
2006-05-24 15:18:58 +00:00
|
|
|
sigact.sa_flags = flags;
|
2006-04-17 14:15:36 +00:00
|
|
|
sigemptyset(&sigact.sa_mask);
|
|
|
|
sigaction(signal, &sigact, NULL);
|
|
|
|
}
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
void showVersion() {
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << PACKAGE << _(" version ") << PACKAGE_VERSION << endl;
|
2006-07-30 12:58:27 +00:00
|
|
|
cout << "**Configuration**" << endl;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
cout << FeatureConfig::getInstance()->getConfigurationSummary();
|
2006-07-30 12:58:27 +00:00
|
|
|
cout << endl;
|
2006-10-01 11:29:14 +00:00
|
|
|
cout << "Copyright (C) 2006 Tatsuhiro Tsujikawa" << endl;
|
|
|
|
cout << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout <<
|
|
|
|
_("This program is free software; you can redistribute it and/or modify\n"
|
|
|
|
"it under the terms of the GNU General Public License as published by\n"
|
|
|
|
"the Free Software Foundation; either version 2 of the License, or\n"
|
|
|
|
"(at your option) any later version.\n"
|
|
|
|
"\n"
|
|
|
|
"This program is distributed in the hope that it will be useful,\n"
|
|
|
|
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
|
|
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
|
|
|
"GNU General Public License for more details.\n"
|
|
|
|
"\n"
|
|
|
|
"You should have received a copy of the GNU General Public License\n"
|
|
|
|
"along with this program; if not, write to the Free Software\n"
|
2006-10-01 14:11:29 +00:00
|
|
|
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n");
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
printf(_("Contact Info: %s\n"), "Tasuhiro Tsujikawa <tujikawa at users dot sourceforge dot net>");
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void showUsage() {
|
2006-03-05 06:32:01 +00:00
|
|
|
printf(_("Usage: %s [options] URL ...\n"), PACKAGE_NAME);
|
2006-04-21 13:04:02 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
printf(_(" %s [options] -T TORRENT_FILE FILE ...\n"), PACKAGE_NAME);
|
2006-04-21 13:04:02 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
printf(_(" %s [options] -M METALINK_FILE\n"), PACKAGE_NAME);
|
|
|
|
#endif // ENABLE_METALINK
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _("Options:") << endl;
|
|
|
|
cout << _(" -d, --dir=DIR The directory to store downloaded file.") << endl;
|
|
|
|
cout << _(" -o, --out=FILE The file name for downloaded file.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" -l, --log=LOG The file path to store log. If '-' is specified,\n"
|
|
|
|
" log is written to stdout.") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -D, --daemon Run as daemon.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" -s, --split=N Download a file using N connections. N must be\n"
|
|
|
|
" between 1 and 5. This option affects all URLs.\n"
|
|
|
|
" Thus, aria2 connects to each URL with\n"
|
|
|
|
" N connections.") << endl;
|
|
|
|
cout << _(" --retry-wait=SEC Set amount of time in second between requests\n"
|
|
|
|
" for errors. Specify a value between 0 and 60.\n"
|
|
|
|
" Default: 5") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -t, --timeout=SEC Set timeout in second. Default: 60") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" -m, --max-tries=N Set number of tries. 0 means unlimited.\n"
|
|
|
|
" Default: 5") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
/*
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
|
|
|
|
" K or M(1K = 1024, 1M = 1024K). This\n"
|
|
|
|
" value must be greater than or equal to\n"
|
2006-08-07 16:05:00 +00:00
|
|
|
" 1024. Default: 1M") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
*/
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n"
|
|
|
|
" URLs.") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" --http-user=USER Set HTTP user. This affects to all URLs.") << endl;
|
|
|
|
cout << _(" --http-passwd=PASSWD Set HTTP password. This affects to all URLs.") << endl;
|
|
|
|
cout << _(" --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs") << endl;
|
|
|
|
cout << _(" --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all URLs.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --http-proxy-method=METHOD Set the method to use in proxy request.\n"
|
|
|
|
" METHOD is either 'get' or 'tunnel'.\n"
|
|
|
|
" Default: tunnel") << endl;
|
|
|
|
cout << _(" --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, basic\n"
|
2006-04-20 15:58:05 +00:00
|
|
|
" is the only supported scheme.\n"
|
|
|
|
" Default: basic") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" --referer=REFERER Set Referer. This affects to all URLs.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --ftp-user=USER Set FTP user. This affects to all URLs.\n"
|
|
|
|
" Default: anonymous") << endl;
|
|
|
|
cout << _(" --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n"
|
|
|
|
" Default: ARIA2USER@") << endl;
|
|
|
|
cout << _(" --ftp-type=TYPE Set FTP transfer type. TYPE is either 'binary'\n"
|
|
|
|
" or 'ascii'.\n"
|
|
|
|
" Default: binary") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -p, --ftp-pasv Use passive mode in FTP.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' or\n"
|
|
|
|
" 'tunnel'.\n"
|
|
|
|
" Default: tunnel") << endl;
|
2006-10-01 14:11:29 +00:00
|
|
|
cout << _(" --lowest-speed-limit=SPEED Close connection if download speed is lower than\n"
|
2006-09-23 12:27:16 +00:00
|
|
|
" or equal to this value(bytes per sec).\n"
|
|
|
|
" 0 means aria2 does not care lowest speed limit.\n"
|
2006-09-21 14:37:15 +00:00
|
|
|
" You can append K or M(1K = 1024, 1M = 1024K).\n"
|
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
" This option does not affect BitTorrent download.\n"
|
|
|
|
" Default: 0") << endl;
|
2006-10-01 14:11:29 +00:00
|
|
|
cout << _(" --max-download-limit=SPEED Set max download speed in bytes per sec.\n"
|
2006-09-23 12:27:16 +00:00
|
|
|
" 0 means unrestricted.\n"
|
2006-09-21 14:37:15 +00:00
|
|
|
" You can append K or M(1K = 1024, 1M = 1024K).\n"
|
|
|
|
" Default: 0") << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << _(" -T, --torrent-file=TORRENT_FILE The file path to .torrent file.") << endl;
|
2006-03-21 14:12:51 +00:00
|
|
|
cout << _(" --follow-torrent=true|false Setting this option to false prevents aria2 to\n"
|
|
|
|
" enter BitTorrent mode even if the filename of\n"
|
|
|
|
" downloaded file ends with .torrent.\n"
|
|
|
|
" Default: true") << endl;
|
2006-04-20 16:09:15 +00:00
|
|
|
cout << _(" -S, --show-files Print file listing of .torrent file and exit.") << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << _(" --direct-file-mapping=true|false Directly read from and write to each file\n"
|
|
|
|
" mentioned in .torrent file.\n"
|
|
|
|
" Default: true") << endl;
|
2006-04-28 15:55:11 +00:00
|
|
|
cout << _(" --listen-port=PORT Set port number to listen to for peer connection.") << endl;
|
2006-10-01 14:11:29 +00:00
|
|
|
cout << _(" --max-upload-limit=SPEED Set max upload speed in bytes per sec.\n"
|
2006-09-23 12:27:16 +00:00
|
|
|
" 0 means unrestricted.\n"
|
2006-09-21 14:37:15 +00:00
|
|
|
" You can append K or M(1K = 1024, 1M = 1024K).\n"
|
|
|
|
" Default: 0") << endl;
|
2006-04-28 15:55:11 +00:00
|
|
|
cout << _(" --select-file=INDEX... Set file to download by specifing its index.\n"
|
|
|
|
" You can know file index through --show-files\n"
|
|
|
|
" option. Multiple indexes can be specified by using\n"
|
|
|
|
" ',' like \"3,6\".\n"
|
|
|
|
" You can also use '-' to specify rangelike \"1-5\".\n"
|
2006-04-29 17:41:49 +00:00
|
|
|
" ',' and '-' can be used together.") << endl;
|
2006-08-27 12:49:17 +00:00
|
|
|
cout << _(" --seed-time=MINUTES Specify seeding time in minutes. See also\n"
|
|
|
|
" --seed-ratio option.") << endl;
|
2006-08-28 15:40:50 +00:00
|
|
|
cout << _(" --seed-ratio=RATIO Specify share ratio. Seed completed torrents until\n"
|
|
|
|
" share ratio reaches RATIO. 1.0 is encouraged.\n"
|
2006-08-27 12:49:17 +00:00
|
|
|
" If --seed-time option is specified along with\n"
|
|
|
|
" this option, seeding ends when at least one of\n"
|
2006-08-28 15:40:50 +00:00
|
|
|
" the conditions is satisfied.") << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
cout << _(" -M, --metalink-file=METALINK_FILE The file path to .metalink file.") << endl;
|
|
|
|
cout << _(" -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n"
|
|
|
|
" simultaneously. If more than one connection per\n"
|
|
|
|
" server is required, use -s option.\n"
|
|
|
|
" Default: 15") << endl;
|
|
|
|
cout << _(" --metalink-version=VERSION The version of file to download.") << endl;
|
|
|
|
cout << _(" --metalink-language=LANGUAGE The language of file to download.") << endl;
|
|
|
|
cout << _(" --metalink-os=OS The operating system the file is targeted.") << endl;
|
|
|
|
cout << _(" --follow-metalink=true|false Setting this option to false prevents aria2 to\n"
|
|
|
|
" enter Metalink mode even if the filename of\n"
|
|
|
|
" downloaded file ends with .metalink.\n"
|
|
|
|
" Default: true") << endl;
|
|
|
|
#endif // ENABLE_METALINK
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -v, --version Print the version number and exit.") << endl;
|
|
|
|
cout << _(" -h, --help Print this message and exit.") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << "URL:" << endl;
|
|
|
|
cout << _(" You can specify multiple URLs. All URLs must point to the same file\n"
|
|
|
|
" or downloading fails.") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << endl;
|
2006-04-21 13:04:02 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << "FILE:" << endl;
|
|
|
|
cout << _(" Specify files in multi-file torrent to download. Use conjunction with\n"
|
2006-04-28 15:55:11 +00:00
|
|
|
" -T option. This arguments are ignored if you specify --select-file option.") << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << endl;
|
2006-04-21 13:04:02 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _("Examples:") << endl;
|
|
|
|
cout << _(" Download a file by 1 connection:") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.zip" << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" Download a file by 2 connections:") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << " aria2c -s 2 http://AAA.BBB.CCC/file.zip" << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" Download a file by 2 connections, each connects to a different server:") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.zip http://DDD.EEE.FFF/GGG/file.zip" << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" You can mix up different protocols:") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.zip ftp://DDD.EEE.FFF/GGG/file.zip" << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
cout << endl;
|
2006-03-21 16:07:22 +00:00
|
|
|
cout << _(" Download a torrent:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -o test.torrent http://AAA.BBB.CCC/file.torrent" << endl;
|
2006-03-21 16:07:22 +00:00
|
|
|
cout << _(" Download a torrent using local .torrent file:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -T test.torrent" << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << _(" Download only selected files:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -T test.torrent dir/file1.zip dir/file2.zip" << endl;
|
2006-04-20 16:09:15 +00:00
|
|
|
cout << _(" Print file listing of .torrent file:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -T test.torrent -S" << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
cout << endl;
|
|
|
|
cout << _(" Metalink downloading:") << endl;
|
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.metalink" << endl;
|
|
|
|
cout << _(" Download a file using local .metalink file:") << endl;
|
|
|
|
cout << " aria2c -M test.metalink" << endl;
|
|
|
|
cout << _(" Metalink downloading with preferences:") << endl;
|
|
|
|
cout << " aria2c -M test.metalink --metalink-version=1.1.1 --metalink-language=en-US" << endl;
|
|
|
|
#endif // ENABLE_METALINK
|
|
|
|
cout << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
printf(_("Report bugs to %s"), "<tujikawa at users dot sourceforge dot net>");
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
long long int getRealSize(char* optarg) {
|
|
|
|
string::size_type p = string(optarg).find_first_of("KM");
|
|
|
|
int mult = 1;
|
|
|
|
if(p != string::npos) {
|
|
|
|
if(optarg[p] == 'K') {
|
|
|
|
mult = 1024;
|
|
|
|
} else if(optarg[p] == 'M') {
|
|
|
|
mult = 1024*1024;
|
2006-07-03 14:19:23 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
optarg[p] = '\0';
|
2006-07-03 14:19:23 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
long long int size = strtoll(optarg, NULL, 10)*mult;
|
|
|
|
return size;
|
2006-07-03 14:19:23 +00:00
|
|
|
}
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
int main(int argc, char* argv[]) {
|
2006-03-05 06:32:01 +00:00
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
setlocale (LC_CTYPE, "");
|
|
|
|
setlocale (LC_MESSAGES, "");
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
textdomain (PACKAGE);
|
|
|
|
#endif // ENABLE_NLS
|
* src/PeerChokeCommand.cc
(optUnchokingPeer): Updated according to the changes in Peer.
(ResetDelta): Removed.
(UploadFaster): Updated according to the changes in Peer.
(DownloadFaster): Updated according to the changes in Peer.
(execute): I clarify the meaning of "upload" and "download"
here.
"upload" means the transfer from localhost to remote host.
"download" means the transfer from remote host to localhost.
Based on this rule, I swapped orderByUploadRate and
orderByDownloadRate.
* src/PeerInteractionCommand.cc
(PeerInteraction): Removed peerInteraction->setUploadLImit().
(executeInternal): Removed the argument of
peerInteraction->sendMessages().
(receiveMessages): Rewritten download speed limit.
(sendKeepAlive): Removed peerInteraction->sendMessages().
* src/HttpResponseCommand.cc
(handleDefaultEncoding): If file size is unknown in torrent
request,
do not call segmentMan->initBitfield() here.
Disabled persistent connection feature in torrent request.
* src/UrlRequestInfo.h
(UrlRequestInfo): Removed const qualifier from option.
* src/TorrentMan.h
(TransferStat): New class.
(deltaDownloadLength): Removed.
(deltaUploadLength): Removed.
(addDeltaDownloadLength): Removed.
(getDeltaDownloadLength): Removed.
(resetDeltaDownloadLength): Removed.
(addDeltaUploadLength): Removed.
(getDeltaUploadLength): Removed.
(resetDeltaUploadLength): Removed.
(addActivePeer): Added peer->activate().
(deleteActivePeer): Added peer->deactivate().
(calculateStat): New function.
* src/TorrentMan.cc
(TorrentMan): Removed deltaDownloadLength and deltaUploadLength.
(calculateStat): New function.
* src/PeerInteraction.h
(uploadLimit): Removed.
(option): New variable.
(setUploadLimit): Removed.
(getUploadSpeed): Removed.
(sendMessages): Removed the argument "currentUploadSpeed".
* src/PeerInteraction.cc
(prefs.h): Included.
(PeerInteraction): Removed uploadLimit. Added option.
(sendMessages): Rewritten upload speed limit.
(sendHandshake): Removed the argument from sendMessages().
(sendBitfield): Removed the argument from sendMessages().
* src/PeerAbstractCommand.cc
(execute): Commented out the portion of upload limit.
(onAbort): Removed peer->resetStatus().
* src/TorrentRequestInfo.cc
(timeoutSpecified): Declared extern.
(execute): Set timeout to 180 if timeout is not specified by.
command-line.
* src/PieceMessage.cc
(receivedAction): Added peer->updateDownloadLength().
Removed peer->addPeerUpload().
Removed torrentMan->addDeltaDownloadLength().
(send): Added peer->updateUploadLength().
Removed peer->addPeerDownload().
Removed torrentMan->addDeltaUploadLength().
* src/main.cc
(timeoutSpecified): New variable.
(main): Set timeoutSpecified to false.
If the command-line option "--upload-limit" is specified, then
timeoutSpecified is set to true. This option will remain in the
next
release, but be deprecated in the future release.
* src/TorrentRequestInfo.h
(TorrentRequestInfo): Removed const qualifier from op.
* src/PeerStat.h
(uploadSpeed): New variable.
(PeerStat): Added default value to cuid.
(calculateUploadSpeed): New function.
(updateUploadLength): New function.
(getMaxUploadSpeed): New function.
(getAvgUploadSpeed): New function.
(reset): Added uploadSpeed. Set status to IDLE.
* src/TorrentDownloadEngine.h
(cp): Declared as Time.
(sessionDownloadLengthArray): Removed.
(sessionUploadLengthArray): Removed.
(currentCp): Removed.
(lastCalcStat): New variable
(lastElapsed): Removed.
(sessionDownloadLength): Removed.
(calculateStat): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): Removed lastElapsed, cp[],
sessionDownloadLengthArray[], sessionUploadLengthArray[],
currentCp, sessionDownloadLength.
Added cp.reset() and lastCalcStat.reset().
(calculateSpeed): Changed the name of the argument.
(calculateStatistics): Rewritten.
(calculateStat): New function.
* src/Peer.h
(PeerStat.h): Included.
(peerUpload): Removed.
(peerDownload): Removed.
(peerStat): New variable.
(sessionUploadLength): New variable.
(sessionDownloadLength): New variable.
(deltaUpload): Removed.
(deltaDownload): Removed.
(resetStatus): Made private.
(Peer): Added sessionUploadLength, sessionDownloadLength.
Removed peerUpload, peerDownload.
(updateUploadLength): New function.
(addDeltaUpload): Removed.
(updateDownloadLength): New function.
(resetDeltaUpload): Removed.
(getDeltaUpload): Removed.
(addDeltaDownload): Removed.
(calculateUploadSpeed): New function.
(resetDeltaDownload): Removed.
(getDeltaDownload): Removed.
(calculateDownloadSpeed): New function.
(getSessionUploadLength): New function.
(getSessionDownloadLength): New function.
(activate): New function.
(deactivate): New function.
(addPeerUpload): Removed.
(setPeerUpload): Removed.
(getPeerUpload): Removed.
(addPeerDownload): Removed.
(setPeerDownload): Removed.
(getPeerDownload): Removed.
* src/Peer.cc
(resetStatus): Removed resetDeltaUpload() and
resetDeltaDownload().
* src/MetalinkRequestInfo.h
(MetalinkRequestInfo): Removed const qualifier from op.
* src/RequestInfo.h
(op): Removed const qualifier.
(RequestInfo): Removed const qualifier from op.
2006-09-21 13:49:06 +00:00
|
|
|
timeoutSpecified = false;
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
int c;
|
|
|
|
Option* op = new Option();
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_STDOUT_LOG, V_FALSE);
|
|
|
|
op->put(PREF_DIR, ".");
|
|
|
|
op->put(PREF_SPLIT, "1");
|
|
|
|
op->put(PREF_DAEMON, V_FALSE);
|
2006-09-19 14:52:59 +00:00
|
|
|
op->put(PREF_SEGMENT_SIZE, Util::itos(1024*1024));
|
|
|
|
op->put(PREF_HTTP_KEEP_ALIVE, V_FALSE);
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_LISTEN_PORT, "-1");
|
|
|
|
op->put(PREF_METALINK_SERVERS, "15");
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_FOLLOW_TORRENT,
|
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
V_TRUE
|
|
|
|
#else
|
|
|
|
V_FALSE
|
|
|
|
#endif // ENABLE_BITTORRENT
|
|
|
|
);
|
|
|
|
op->put(PREF_FOLLOW_METALINK,
|
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
V_TRUE
|
|
|
|
#else
|
|
|
|
V_FALSE
|
|
|
|
#endif // ENABLE_METALINK
|
|
|
|
);
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_RETRY_WAIT, "5");
|
|
|
|
op->put(PREF_TIMEOUT, "60");
|
2006-10-01 14:11:29 +00:00
|
|
|
op->put(PREF_DNS_TIMEOUT, "10");
|
2006-03-31 13:58:22 +00:00
|
|
|
op->put(PREF_PEER_CONNECTION_TIMEOUT, "60");
|
2006-02-22 11:18:47 +00:00
|
|
|
op->put(PREF_MIN_SEGMENT_SIZE, "1048576");// 1M
|
|
|
|
op->put(PREF_MAX_TRIES, "5");
|
2006-04-19 17:23:58 +00:00
|
|
|
op->put(PREF_HTTP_AUTH_SCHEME, V_BASIC);
|
2006-02-22 15:40:04 +00:00
|
|
|
op->put(PREF_HTTP_PROXY_METHOD, V_TUNNEL);
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_FTP_USER, "anonymous");
|
|
|
|
op->put(PREF_FTP_PASSWD, "ARIA2USER@");
|
|
|
|
op->put(PREF_FTP_TYPE, V_BINARY);
|
|
|
|
op->put(PREF_FTP_VIA_HTTP_PROXY, V_TUNNEL);
|
2006-03-21 14:12:51 +00:00
|
|
|
op->put(PREF_AUTO_SAVE_INTERVAL, "60");
|
2006-04-12 13:55:43 +00:00
|
|
|
op->put(PREF_DIRECT_FILE_MAPPING, V_TRUE);
|
2006-08-11 12:29:55 +00:00
|
|
|
op->put(PREF_LOWEST_SPEED_LIMIT, "0");
|
2006-09-21 14:37:15 +00:00
|
|
|
op->put(PREF_MAX_DOWNLOAD_LIMIT, "0");
|
|
|
|
op->put(PREF_MAX_UPLOAD_LIMIT, "0");
|
2006-09-21 06:56:54 +00:00
|
|
|
op->put(PREF_STARTUP_IDLE_TIME, "10");
|
2006-02-17 13:35:04 +00:00
|
|
|
while(1) {
|
|
|
|
int optIndex = 0;
|
|
|
|
int lopt;
|
|
|
|
static struct option longOpts[] = {
|
|
|
|
{ "daemon", no_argument, NULL, 'D' },
|
|
|
|
{ "dir", required_argument, NULL, 'd' },
|
|
|
|
{ "out", required_argument, NULL, 'o' },
|
|
|
|
{ "log", required_argument, NULL, 'l' },
|
|
|
|
{ "split", required_argument, NULL, 's' },
|
2006-02-21 14:00:58 +00:00
|
|
|
{ "timeout", required_argument, NULL, 't' },
|
2006-03-05 06:32:01 +00:00
|
|
|
{ "max-tries", required_argument, NULL, 'm' },
|
2006-02-17 13:35:04 +00:00
|
|
|
{ "http-proxy", required_argument, &lopt, 1 },
|
|
|
|
{ "http-user", required_argument, &lopt, 2 },
|
|
|
|
{ "http-passwd", required_argument, &lopt, 3 },
|
|
|
|
{ "http-proxy-user", required_argument, &lopt, 4 },
|
|
|
|
{ "http-proxy-passwd", required_argument, &lopt, 5 },
|
|
|
|
{ "http-auth-scheme", required_argument, &lopt, 6 },
|
2006-02-18 03:59:26 +00:00
|
|
|
{ "referer", required_argument, &lopt, 7 },
|
2006-02-18 05:13:21 +00:00
|
|
|
{ "retry-wait", required_argument, &lopt, 8 },
|
2006-02-21 14:00:58 +00:00
|
|
|
{ "ftp-user", required_argument, &lopt, 9 },
|
|
|
|
{ "ftp-passwd", required_argument, &lopt, 10 },
|
|
|
|
{ "ftp-type", required_argument, &lopt, 11 },
|
|
|
|
{ "ftp-pasv", no_argument, NULL, 'p' },
|
|
|
|
{ "ftp-via-http-proxy", required_argument, &lopt, 12 },
|
2006-09-23 12:27:16 +00:00
|
|
|
//{ "min-segment-size", required_argument, &lopt, 13 },
|
2006-02-22 15:40:04 +00:00
|
|
|
{ "http-proxy-method", required_argument, &lopt, 14 },
|
2006-08-07 16:05:00 +00:00
|
|
|
{ "lowest-speed-limit", required_argument, &lopt, 200 },
|
2006-09-21 14:37:15 +00:00
|
|
|
{ "max-download-limit", required_argument, &lopt, 201 },
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
{ "torrent-file", required_argument, NULL, 'T' },
|
|
|
|
{ "listen-port", required_argument, &lopt, 15 },
|
2006-03-21 14:12:51 +00:00
|
|
|
{ "follow-torrent", required_argument, &lopt, 16 },
|
2006-04-18 17:06:17 +00:00
|
|
|
{ "show-files", no_argument, NULL, 'S' },
|
2006-04-06 12:52:16 +00:00
|
|
|
{ "no-preallocation", no_argument, &lopt, 18 },
|
2006-04-12 13:55:43 +00:00
|
|
|
{ "direct-file-mapping", required_argument, &lopt, 19 },
|
2006-09-21 14:37:15 +00:00
|
|
|
// TODO remove upload-limit.
|
2006-04-28 15:55:11 +00:00
|
|
|
{ "upload-limit", required_argument, &lopt, 20 },
|
|
|
|
{ "select-file", required_argument, &lopt, 21 },
|
2006-08-27 12:49:17 +00:00
|
|
|
{ "seed-time", required_argument, &lopt, 22 },
|
|
|
|
{ "seed-ratio", required_argument, &lopt, 23 },
|
2006-09-21 14:37:15 +00:00
|
|
|
{ "max-upload-limit", required_argument, &lopt, 24 },
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-03 14:19:23 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
{ "metalink-file", required_argument, NULL, 'M' },
|
2006-07-04 10:57:56 +00:00
|
|
|
{ "metalink-servers", required_argument, NULL, 'C' },
|
|
|
|
{ "metalink-version", required_argument, &lopt, 100 },
|
|
|
|
{ "metalink-language", required_argument, &lopt, 101 },
|
|
|
|
{ "metalink-os", required_argument, &lopt, 102 },
|
|
|
|
{ "follow-metalink", required_argument, &lopt, 103 },
|
2006-07-03 14:19:23 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2006-02-17 13:35:04 +00:00
|
|
|
{ "version", no_argument, NULL, 'v' },
|
|
|
|
{ "help", no_argument, NULL, 'h' },
|
|
|
|
{ 0, 0, 0, 0 }
|
|
|
|
};
|
2006-07-03 14:19:23 +00:00
|
|
|
c = getopt_long(argc, argv, "Dd:o:l:s:pt:m:vhST:M:C:", longOpts, &optIndex);
|
2006-02-17 13:35:04 +00:00
|
|
|
if(c == -1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case 0:{
|
|
|
|
switch(lopt) {
|
|
|
|
case 1: {
|
|
|
|
pair<string, string> proxy;
|
|
|
|
Util::split(proxy, optarg, ':');
|
|
|
|
int port = (int)strtol(proxy.second.c_str(), NULL, 10);
|
|
|
|
if(proxy.first.empty() || proxy.second.empty() ||
|
|
|
|
!(0 < port && port <= 65535)) {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("unrecognized proxy format") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_HTTP_PROXY_HOST, proxy.first);
|
|
|
|
op->put(PREF_HTTP_PROXY_PORT, Util::itos(port));
|
|
|
|
op->put(PREF_HTTP_PROXY_ENABLED, V_TRUE);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_HTTP_USER, optarg);
|
2006-04-19 17:23:58 +00:00
|
|
|
op->put(PREF_HTTP_AUTH_ENABLED, V_TRUE);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_HTTP_PASSWD, optarg);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_HTTP_PROXY_USER, optarg);
|
|
|
|
op->put(PREF_HTTP_PROXY_AUTH_ENABLED, V_TRUE);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_HTTP_PROXY_PASSWD, optarg);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2006-02-21 14:00:58 +00:00
|
|
|
if(string(V_BASIC) == optarg) {
|
|
|
|
op->put(PREF_HTTP_AUTH_SCHEME, V_BASIC);
|
2006-02-17 13:35:04 +00:00
|
|
|
} else {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("Currently, supported authentication scheme is basic.") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-02-18 03:59:26 +00:00
|
|
|
case 7:
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_REFERER, optarg);
|
2006-02-18 03:59:26 +00:00
|
|
|
break;
|
2006-02-18 05:13:21 +00:00
|
|
|
case 8: {
|
|
|
|
int wait = (int)strtol(optarg, NULL, 10);
|
|
|
|
if(!(0 <= wait && wait <= 60)) {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("retry-wait must be between 0 and 60.") << endl;
|
2006-02-18 05:13:21 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-18 05:13:21 +00:00
|
|
|
}
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_RETRY_WAIT, Util::itos(wait));
|
2006-02-18 05:13:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-02-21 14:00:58 +00:00
|
|
|
case 9:
|
|
|
|
op->put(PREF_FTP_USER, optarg);
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
op->put(PREF_FTP_PASSWD, optarg);
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
if(string(optarg) == V_BINARY || string(optarg) == V_ASCII) {
|
|
|
|
op->put(PREF_FTP_TYPE, optarg);
|
|
|
|
} else {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("ftp-type must be either 'binary' or 'ascii'.") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-21 14:00:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
if(string(optarg) == V_GET || string(optarg) == V_TUNNEL) {
|
|
|
|
op->put(PREF_FTP_VIA_HTTP_PROXY, optarg);
|
|
|
|
} else {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("ftp-via-http-proxy must be either 'get' or 'tunnel'.") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-21 14:00:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-02-22 11:18:47 +00:00
|
|
|
case 13: {
|
2006-08-07 16:05:00 +00:00
|
|
|
long long int size = getRealSize(optarg);
|
2006-03-05 06:32:01 +00:00
|
|
|
if(size < 1024) {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("min-segment-size invalid") << endl;
|
2006-02-22 11:18:47 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-22 11:18:47 +00:00
|
|
|
}
|
|
|
|
op->put(PREF_MIN_SEGMENT_SIZE, Util::llitos(size));
|
|
|
|
break;
|
|
|
|
}
|
2006-02-22 15:40:04 +00:00
|
|
|
case 14:
|
|
|
|
if(string(optarg) == V_GET || string(optarg) == V_TUNNEL) {
|
|
|
|
op->put(PREF_HTTP_PROXY_METHOD, optarg);
|
|
|
|
} else {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("http-proxy-method must be either 'get' or 'tunnel'.") << endl;
|
2006-02-22 15:40:04 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-22 15:40:04 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
case 15: {
|
|
|
|
int listenPort = (int)strtol(optarg, NULL, 10);
|
2006-04-18 17:06:17 +00:00
|
|
|
if(!(1024 <= listenPort && listenPort <= 65535)) {
|
|
|
|
cerr << _("listen-port must be between 1024 and 65535.") << endl;
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-04-18 17:06:17 +00:00
|
|
|
}
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_LISTEN_PORT, Util::itos(listenPort));
|
2006-03-21 14:12:51 +00:00
|
|
|
break;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
}
|
2006-03-21 14:12:51 +00:00
|
|
|
case 16:
|
2006-03-21 16:54:42 +00:00
|
|
|
if(string(optarg) == "true") {
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_FOLLOW_TORRENT, V_TRUE);
|
2006-03-21 16:54:42 +00:00
|
|
|
} else if(string(optarg) == "false") {
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_FOLLOW_TORRENT, V_FALSE);
|
2006-03-21 14:12:51 +00:00
|
|
|
} else {
|
|
|
|
cerr << _("follow-torrent must be either 'true' or 'false'.") << endl;
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-04-06 12:52:16 +00:00
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
op->put(PREF_NO_PREALLOCATION, V_TRUE);
|
|
|
|
break;
|
2006-04-12 13:55:43 +00:00
|
|
|
case 19:
|
|
|
|
if(string(optarg) == "true") {
|
|
|
|
op->put(PREF_DIRECT_FILE_MAPPING, V_TRUE);
|
|
|
|
} else if(string(optarg) == "false") {
|
|
|
|
op->put(PREF_DIRECT_FILE_MAPPING, V_FALSE);
|
|
|
|
} else {
|
2006-04-28 15:55:11 +00:00
|
|
|
cerr << _("direct-file-mapping must be either 'true' or 'false'.") << endl;
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-04-28 15:55:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 20: {
|
2006-09-21 14:37:15 +00:00
|
|
|
cerr << "Warning: upload-limit will be deprecated in the future release.\n"
|
|
|
|
"Use max-upload-limit instead. Because there is a difference between them,\n"
|
|
|
|
"take a look at the description of max-upload-limit option." << endl;
|
* src/PeerChokeCommand.cc
(optUnchokingPeer): Updated according to the changes in Peer.
(ResetDelta): Removed.
(UploadFaster): Updated according to the changes in Peer.
(DownloadFaster): Updated according to the changes in Peer.
(execute): I clarify the meaning of "upload" and "download"
here.
"upload" means the transfer from localhost to remote host.
"download" means the transfer from remote host to localhost.
Based on this rule, I swapped orderByUploadRate and
orderByDownloadRate.
* src/PeerInteractionCommand.cc
(PeerInteraction): Removed peerInteraction->setUploadLImit().
(executeInternal): Removed the argument of
peerInteraction->sendMessages().
(receiveMessages): Rewritten download speed limit.
(sendKeepAlive): Removed peerInteraction->sendMessages().
* src/HttpResponseCommand.cc
(handleDefaultEncoding): If file size is unknown in torrent
request,
do not call segmentMan->initBitfield() here.
Disabled persistent connection feature in torrent request.
* src/UrlRequestInfo.h
(UrlRequestInfo): Removed const qualifier from option.
* src/TorrentMan.h
(TransferStat): New class.
(deltaDownloadLength): Removed.
(deltaUploadLength): Removed.
(addDeltaDownloadLength): Removed.
(getDeltaDownloadLength): Removed.
(resetDeltaDownloadLength): Removed.
(addDeltaUploadLength): Removed.
(getDeltaUploadLength): Removed.
(resetDeltaUploadLength): Removed.
(addActivePeer): Added peer->activate().
(deleteActivePeer): Added peer->deactivate().
(calculateStat): New function.
* src/TorrentMan.cc
(TorrentMan): Removed deltaDownloadLength and deltaUploadLength.
(calculateStat): New function.
* src/PeerInteraction.h
(uploadLimit): Removed.
(option): New variable.
(setUploadLimit): Removed.
(getUploadSpeed): Removed.
(sendMessages): Removed the argument "currentUploadSpeed".
* src/PeerInteraction.cc
(prefs.h): Included.
(PeerInteraction): Removed uploadLimit. Added option.
(sendMessages): Rewritten upload speed limit.
(sendHandshake): Removed the argument from sendMessages().
(sendBitfield): Removed the argument from sendMessages().
* src/PeerAbstractCommand.cc
(execute): Commented out the portion of upload limit.
(onAbort): Removed peer->resetStatus().
* src/TorrentRequestInfo.cc
(timeoutSpecified): Declared extern.
(execute): Set timeout to 180 if timeout is not specified by.
command-line.
* src/PieceMessage.cc
(receivedAction): Added peer->updateDownloadLength().
Removed peer->addPeerUpload().
Removed torrentMan->addDeltaDownloadLength().
(send): Added peer->updateUploadLength().
Removed peer->addPeerDownload().
Removed torrentMan->addDeltaUploadLength().
* src/main.cc
(timeoutSpecified): New variable.
(main): Set timeoutSpecified to false.
If the command-line option "--upload-limit" is specified, then
timeoutSpecified is set to true. This option will remain in the
next
release, but be deprecated in the future release.
* src/TorrentRequestInfo.h
(TorrentRequestInfo): Removed const qualifier from op.
* src/PeerStat.h
(uploadSpeed): New variable.
(PeerStat): Added default value to cuid.
(calculateUploadSpeed): New function.
(updateUploadLength): New function.
(getMaxUploadSpeed): New function.
(getAvgUploadSpeed): New function.
(reset): Added uploadSpeed. Set status to IDLE.
* src/TorrentDownloadEngine.h
(cp): Declared as Time.
(sessionDownloadLengthArray): Removed.
(sessionUploadLengthArray): Removed.
(currentCp): Removed.
(lastCalcStat): New variable
(lastElapsed): Removed.
(sessionDownloadLength): Removed.
(calculateStat): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): Removed lastElapsed, cp[],
sessionDownloadLengthArray[], sessionUploadLengthArray[],
currentCp, sessionDownloadLength.
Added cp.reset() and lastCalcStat.reset().
(calculateSpeed): Changed the name of the argument.
(calculateStatistics): Rewritten.
(calculateStat): New function.
* src/Peer.h
(PeerStat.h): Included.
(peerUpload): Removed.
(peerDownload): Removed.
(peerStat): New variable.
(sessionUploadLength): New variable.
(sessionDownloadLength): New variable.
(deltaUpload): Removed.
(deltaDownload): Removed.
(resetStatus): Made private.
(Peer): Added sessionUploadLength, sessionDownloadLength.
Removed peerUpload, peerDownload.
(updateUploadLength): New function.
(addDeltaUpload): Removed.
(updateDownloadLength): New function.
(resetDeltaUpload): Removed.
(getDeltaUpload): Removed.
(addDeltaDownload): Removed.
(calculateUploadSpeed): New function.
(resetDeltaDownload): Removed.
(getDeltaDownload): Removed.
(calculateDownloadSpeed): New function.
(getSessionUploadLength): New function.
(getSessionDownloadLength): New function.
(activate): New function.
(deactivate): New function.
(addPeerUpload): Removed.
(setPeerUpload): Removed.
(getPeerUpload): Removed.
(addPeerDownload): Removed.
(setPeerDownload): Removed.
(getPeerDownload): Removed.
* src/Peer.cc
(resetStatus): Removed resetDeltaUpload() and
resetDeltaDownload().
* src/MetalinkRequestInfo.h
(MetalinkRequestInfo): Removed const qualifier from op.
* src/RequestInfo.h
(op): Removed const qualifier.
(RequestInfo): Removed const qualifier from op.
2006-09-21 13:49:06 +00:00
|
|
|
int uploadSpeed = strtol(optarg, NULL, 10)*1024;
|
2006-04-28 15:55:11 +00:00
|
|
|
if(0 > uploadSpeed) {
|
2006-05-06 01:08:42 +00:00
|
|
|
cerr << _("upload-limit must be greater than or equal to 0.") << endl;
|
2006-04-12 13:55:43 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-04-12 13:55:43 +00:00
|
|
|
}
|
2006-09-21 14:37:15 +00:00
|
|
|
op->put(PREF_MAX_UPLOAD_LIMIT, Util::itos(uploadSpeed));
|
2006-04-28 15:55:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 21:
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_SELECT_FILE, optarg);
|
2006-04-28 15:55:11 +00:00
|
|
|
break;
|
2006-08-27 12:49:17 +00:00
|
|
|
case 22: {
|
|
|
|
int seedTime = (int)strtol(optarg, NULL, 10);
|
|
|
|
if(seedTime < 0) {
|
|
|
|
cerr << _("seed-time must be greater than or equal to 0.") << endl;
|
|
|
|
showUsage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
op->put(PREF_SEED_TIME, Util::itos(seedTime));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 23: {
|
|
|
|
double ratio = (int)strtod(optarg, NULL);
|
|
|
|
if(ratio < 0.0) {
|
|
|
|
cerr << _("seed-ratio must be greater than or equal to 0.0.") << endl;
|
|
|
|
showUsage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
op->put(PREF_SEED_RATIO, optarg);
|
|
|
|
break;
|
|
|
|
}
|
2006-09-21 14:37:15 +00:00
|
|
|
case 24: {
|
|
|
|
int limit = getRealSize(optarg);
|
|
|
|
if(limit < 0) {
|
|
|
|
cerr << _("max-upload-limit must be greater than or equal to 0") << endl;
|
|
|
|
showUsage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
op->put(PREF_MAX_UPLOAD_LIMIT, Util::itos(limit));
|
|
|
|
break;
|
|
|
|
}
|
2006-07-04 10:57:56 +00:00
|
|
|
case 100:
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_METALINK_VERSION, optarg);
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
|
|
|
case 101:
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_METALINK_LANGUAGE, optarg);
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
|
|
|
case 102:
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_METALINK_OS, optarg);
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
|
|
|
case 103:
|
|
|
|
if(string(optarg) == "true") {
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_FOLLOW_METALINK, V_TRUE);
|
2006-07-04 10:57:56 +00:00
|
|
|
} else if(string(optarg) == "false") {
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_FOLLOW_METALINK, V_FALSE);
|
2006-07-04 10:57:56 +00:00
|
|
|
} else {
|
|
|
|
cerr << _("follow-metalink must be either 'true' or 'false'.") << endl;
|
|
|
|
showUsage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
break;
|
2006-08-07 16:05:00 +00:00
|
|
|
case 200: {
|
|
|
|
int limit = getRealSize(optarg);
|
|
|
|
if(limit < 0) {
|
|
|
|
cerr << _("lowest-speed-limit must be greater than or equal to 0") << endl;
|
|
|
|
showUsage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
op->put(PREF_LOWEST_SPEED_LIMIT, Util::itos(limit));
|
|
|
|
break;
|
|
|
|
}
|
2006-09-21 14:37:15 +00:00
|
|
|
case 201: {
|
|
|
|
int limit = getRealSize(optarg);
|
|
|
|
if(limit < 0) {
|
|
|
|
cerr << _("max-download-limit must be greater than or equal to 0") << endl;
|
|
|
|
showUsage();
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
op->put(PREF_MAX_DOWNLOAD_LIMIT, Util::itos(limit));
|
|
|
|
break;
|
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'D':
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_DAEMON, V_TRUE);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 'd':
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_DIR, optarg);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 'o':
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_OUT, optarg);
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
if(strcmp("-", optarg) == 0) {
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_STDOUT_LOG, V_TRUE);
|
2006-02-17 13:35:04 +00:00
|
|
|
} else {
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_LOG, optarg);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
case 's': {
|
|
|
|
int split = (int)strtol(optarg, NULL, 10);
|
2006-02-21 14:00:58 +00:00
|
|
|
if(!(1 <= split && split <= 5)) {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("split must be between 1 and 5.") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_SPLIT, Util::itos(split));
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
}
|
2006-02-21 14:00:58 +00:00
|
|
|
case 't': {
|
|
|
|
int timeout = (int)strtol(optarg, NULL, 10);
|
|
|
|
if(1 <= timeout && timeout <= 600) {
|
|
|
|
op->put(PREF_TIMEOUT, Util::itos(timeout));
|
* src/PeerChokeCommand.cc
(optUnchokingPeer): Updated according to the changes in Peer.
(ResetDelta): Removed.
(UploadFaster): Updated according to the changes in Peer.
(DownloadFaster): Updated according to the changes in Peer.
(execute): I clarify the meaning of "upload" and "download"
here.
"upload" means the transfer from localhost to remote host.
"download" means the transfer from remote host to localhost.
Based on this rule, I swapped orderByUploadRate and
orderByDownloadRate.
* src/PeerInteractionCommand.cc
(PeerInteraction): Removed peerInteraction->setUploadLImit().
(executeInternal): Removed the argument of
peerInteraction->sendMessages().
(receiveMessages): Rewritten download speed limit.
(sendKeepAlive): Removed peerInteraction->sendMessages().
* src/HttpResponseCommand.cc
(handleDefaultEncoding): If file size is unknown in torrent
request,
do not call segmentMan->initBitfield() here.
Disabled persistent connection feature in torrent request.
* src/UrlRequestInfo.h
(UrlRequestInfo): Removed const qualifier from option.
* src/TorrentMan.h
(TransferStat): New class.
(deltaDownloadLength): Removed.
(deltaUploadLength): Removed.
(addDeltaDownloadLength): Removed.
(getDeltaDownloadLength): Removed.
(resetDeltaDownloadLength): Removed.
(addDeltaUploadLength): Removed.
(getDeltaUploadLength): Removed.
(resetDeltaUploadLength): Removed.
(addActivePeer): Added peer->activate().
(deleteActivePeer): Added peer->deactivate().
(calculateStat): New function.
* src/TorrentMan.cc
(TorrentMan): Removed deltaDownloadLength and deltaUploadLength.
(calculateStat): New function.
* src/PeerInteraction.h
(uploadLimit): Removed.
(option): New variable.
(setUploadLimit): Removed.
(getUploadSpeed): Removed.
(sendMessages): Removed the argument "currentUploadSpeed".
* src/PeerInteraction.cc
(prefs.h): Included.
(PeerInteraction): Removed uploadLimit. Added option.
(sendMessages): Rewritten upload speed limit.
(sendHandshake): Removed the argument from sendMessages().
(sendBitfield): Removed the argument from sendMessages().
* src/PeerAbstractCommand.cc
(execute): Commented out the portion of upload limit.
(onAbort): Removed peer->resetStatus().
* src/TorrentRequestInfo.cc
(timeoutSpecified): Declared extern.
(execute): Set timeout to 180 if timeout is not specified by.
command-line.
* src/PieceMessage.cc
(receivedAction): Added peer->updateDownloadLength().
Removed peer->addPeerUpload().
Removed torrentMan->addDeltaDownloadLength().
(send): Added peer->updateUploadLength().
Removed peer->addPeerDownload().
Removed torrentMan->addDeltaUploadLength().
* src/main.cc
(timeoutSpecified): New variable.
(main): Set timeoutSpecified to false.
If the command-line option "--upload-limit" is specified, then
timeoutSpecified is set to true. This option will remain in the
next
release, but be deprecated in the future release.
* src/TorrentRequestInfo.h
(TorrentRequestInfo): Removed const qualifier from op.
* src/PeerStat.h
(uploadSpeed): New variable.
(PeerStat): Added default value to cuid.
(calculateUploadSpeed): New function.
(updateUploadLength): New function.
(getMaxUploadSpeed): New function.
(getAvgUploadSpeed): New function.
(reset): Added uploadSpeed. Set status to IDLE.
* src/TorrentDownloadEngine.h
(cp): Declared as Time.
(sessionDownloadLengthArray): Removed.
(sessionUploadLengthArray): Removed.
(currentCp): Removed.
(lastCalcStat): New variable
(lastElapsed): Removed.
(sessionDownloadLength): Removed.
(calculateStat): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): Removed lastElapsed, cp[],
sessionDownloadLengthArray[], sessionUploadLengthArray[],
currentCp, sessionDownloadLength.
Added cp.reset() and lastCalcStat.reset().
(calculateSpeed): Changed the name of the argument.
(calculateStatistics): Rewritten.
(calculateStat): New function.
* src/Peer.h
(PeerStat.h): Included.
(peerUpload): Removed.
(peerDownload): Removed.
(peerStat): New variable.
(sessionUploadLength): New variable.
(sessionDownloadLength): New variable.
(deltaUpload): Removed.
(deltaDownload): Removed.
(resetStatus): Made private.
(Peer): Added sessionUploadLength, sessionDownloadLength.
Removed peerUpload, peerDownload.
(updateUploadLength): New function.
(addDeltaUpload): Removed.
(updateDownloadLength): New function.
(resetDeltaUpload): Removed.
(getDeltaUpload): Removed.
(addDeltaDownload): Removed.
(calculateUploadSpeed): New function.
(resetDeltaDownload): Removed.
(getDeltaDownload): Removed.
(calculateDownloadSpeed): New function.
(getSessionUploadLength): New function.
(getSessionDownloadLength): New function.
(activate): New function.
(deactivate): New function.
(addPeerUpload): Removed.
(setPeerUpload): Removed.
(getPeerUpload): Removed.
(addPeerDownload): Removed.
(setPeerDownload): Removed.
(getPeerDownload): Removed.
* src/Peer.cc
(resetStatus): Removed resetDeltaUpload() and
resetDeltaDownload().
* src/MetalinkRequestInfo.h
(MetalinkRequestInfo): Removed const qualifier from op.
* src/RequestInfo.h
(op): Removed const qualifier.
(RequestInfo): Removed const qualifier from op.
2006-09-21 13:49:06 +00:00
|
|
|
timeoutSpecified = true;
|
2006-02-21 14:00:58 +00:00
|
|
|
} else {
|
2006-03-02 10:43:00 +00:00
|
|
|
cerr << _("timeout must be between 1 and 600") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-21 14:00:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-02-22 11:18:47 +00:00
|
|
|
case 'm': {
|
|
|
|
int retries = (int)strtol(optarg, NULL, 10);
|
|
|
|
if(retries < 0) {
|
2006-03-05 06:32:01 +00:00
|
|
|
cerr << _("max-tries invalid") << endl;
|
2006-02-22 11:18:47 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-22 11:18:47 +00:00
|
|
|
}
|
|
|
|
op->put(PREF_MAX_TRIES, Util::itos(retries));
|
|
|
|
break;
|
|
|
|
}
|
2006-02-21 14:00:58 +00:00
|
|
|
case 'p':
|
|
|
|
op->put(PREF_FTP_PASV_ENABLED, V_TRUE);
|
|
|
|
break;
|
2006-04-18 17:06:17 +00:00
|
|
|
case 'S':
|
|
|
|
op->put(PREF_SHOW_FILES, V_TRUE);
|
|
|
|
break;
|
|
|
|
case 'T':
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_TORRENT_FILE, optarg);
|
2006-04-18 17:06:17 +00:00
|
|
|
break;
|
2006-07-03 14:19:23 +00:00
|
|
|
case 'M':
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_METALINK_FILE, optarg);
|
2006-07-03 14:19:23 +00:00
|
|
|
break;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
case 'C': {
|
|
|
|
int metalinkServers = (int)strtol(optarg, NULL, 10);
|
2006-07-04 10:57:56 +00:00
|
|
|
if(metalinkServers <= 0) {
|
|
|
|
cerr << _("metalink-servers must be greater than 0.") << endl;
|
2006-07-03 14:19:23 +00:00
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-07-03 14:19:23 +00:00
|
|
|
}
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_METALINK_SERVERS, Util::itos(metalinkServers));
|
|
|
|
break;
|
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
case 'v':
|
|
|
|
showVersion();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_SUCCESS);
|
2006-02-17 13:35:04 +00:00
|
|
|
case 'h':
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_SUCCESS);
|
2006-02-17 13:35:04 +00:00
|
|
|
default:
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
if(!op->defined(PREF_TORRENT_FILE) && !op->defined(PREF_METALINK_FILE)) {
|
2006-03-21 14:12:51 +00:00
|
|
|
if(optind == argc) {
|
|
|
|
cerr << _("specify at least one URL") << endl;
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
if(op->getAsBool(PREF_DAEMON)) {
|
2006-02-17 13:35:04 +00:00
|
|
|
if(daemon(1, 1) < 0) {
|
2006-04-18 17:06:17 +00:00
|
|
|
perror(_("daemon failed"));
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-28 15:55:11 +00:00
|
|
|
Strings args(argv+optind, argv+argc);
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
|
2006-02-17 18:51:12 +00:00
|
|
|
#ifdef HAVE_LIBSSL
|
|
|
|
// for SSL initialization
|
|
|
|
SSL_load_error_strings();
|
|
|
|
SSL_library_init();
|
|
|
|
#endif // HAVE_LIBSSL
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
gnutls_global_init();
|
|
|
|
#endif // HAVE_LIBGNUTLS
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
2006-07-03 14:19:23 +00:00
|
|
|
xmlInitParser();
|
2006-07-04 10:57:56 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2006-03-21 14:12:51 +00:00
|
|
|
srandom(time(NULL));
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
if(op->getAsBool(PREF_STDOUT_LOG)) {
|
2006-04-17 16:17:20 +00:00
|
|
|
LogFactory::setLogFile("/dev/stdout");
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
} else if(op->get(PREF_LOG).size()) {
|
|
|
|
LogFactory::setLogFile(op->get(PREF_LOG));
|
2006-08-27 12:49:17 +00:00
|
|
|
} else {
|
|
|
|
LogFactory::setLogFile("/dev/null");
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-04-19 17:23:58 +00:00
|
|
|
// make sure logger is configured properly.
|
|
|
|
try {
|
2006-08-07 16:05:00 +00:00
|
|
|
Logger* logger = LogFactory::getInstance();
|
|
|
|
logger->info("%s %s", PACKAGE, PACKAGE_VERSION);
|
|
|
|
logger->info("Logging started.");
|
2006-04-19 17:23:58 +00:00
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
setSignalHander(SIGPIPE, SIG_IGN, 0);
|
2006-03-21 14:12:51 +00:00
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
requestInfo = 0;
|
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
if(op->defined(PREF_TORRENT_FILE)) {
|
|
|
|
requestInfo = new TorrentRequestInfo(op->get(PREF_TORRENT_FILE),
|
|
|
|
op);
|
|
|
|
Strings targetFiles;
|
|
|
|
if(op->defined(PREF_TORRENT_FILE) && !args.empty()) {
|
|
|
|
targetFiles = args;
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
((TorrentRequestInfo*)requestInfo)->setTargetFiles(targetFiles);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
else
|
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
2006-08-07 16:05:00 +00:00
|
|
|
if(op->defined(PREF_METALINK_FILE)) {
|
* src/PeerChokeCommand.cc
(optUnchokingPeer): Updated according to the changes in Peer.
(ResetDelta): Removed.
(UploadFaster): Updated according to the changes in Peer.
(DownloadFaster): Updated according to the changes in Peer.
(execute): I clarify the meaning of "upload" and "download"
here.
"upload" means the transfer from localhost to remote host.
"download" means the transfer from remote host to localhost.
Based on this rule, I swapped orderByUploadRate and
orderByDownloadRate.
* src/PeerInteractionCommand.cc
(PeerInteraction): Removed peerInteraction->setUploadLImit().
(executeInternal): Removed the argument of
peerInteraction->sendMessages().
(receiveMessages): Rewritten download speed limit.
(sendKeepAlive): Removed peerInteraction->sendMessages().
* src/HttpResponseCommand.cc
(handleDefaultEncoding): If file size is unknown in torrent
request,
do not call segmentMan->initBitfield() here.
Disabled persistent connection feature in torrent request.
* src/UrlRequestInfo.h
(UrlRequestInfo): Removed const qualifier from option.
* src/TorrentMan.h
(TransferStat): New class.
(deltaDownloadLength): Removed.
(deltaUploadLength): Removed.
(addDeltaDownloadLength): Removed.
(getDeltaDownloadLength): Removed.
(resetDeltaDownloadLength): Removed.
(addDeltaUploadLength): Removed.
(getDeltaUploadLength): Removed.
(resetDeltaUploadLength): Removed.
(addActivePeer): Added peer->activate().
(deleteActivePeer): Added peer->deactivate().
(calculateStat): New function.
* src/TorrentMan.cc
(TorrentMan): Removed deltaDownloadLength and deltaUploadLength.
(calculateStat): New function.
* src/PeerInteraction.h
(uploadLimit): Removed.
(option): New variable.
(setUploadLimit): Removed.
(getUploadSpeed): Removed.
(sendMessages): Removed the argument "currentUploadSpeed".
* src/PeerInteraction.cc
(prefs.h): Included.
(PeerInteraction): Removed uploadLimit. Added option.
(sendMessages): Rewritten upload speed limit.
(sendHandshake): Removed the argument from sendMessages().
(sendBitfield): Removed the argument from sendMessages().
* src/PeerAbstractCommand.cc
(execute): Commented out the portion of upload limit.
(onAbort): Removed peer->resetStatus().
* src/TorrentRequestInfo.cc
(timeoutSpecified): Declared extern.
(execute): Set timeout to 180 if timeout is not specified by.
command-line.
* src/PieceMessage.cc
(receivedAction): Added peer->updateDownloadLength().
Removed peer->addPeerUpload().
Removed torrentMan->addDeltaDownloadLength().
(send): Added peer->updateUploadLength().
Removed peer->addPeerDownload().
Removed torrentMan->addDeltaUploadLength().
* src/main.cc
(timeoutSpecified): New variable.
(main): Set timeoutSpecified to false.
If the command-line option "--upload-limit" is specified, then
timeoutSpecified is set to true. This option will remain in the
next
release, but be deprecated in the future release.
* src/TorrentRequestInfo.h
(TorrentRequestInfo): Removed const qualifier from op.
* src/PeerStat.h
(uploadSpeed): New variable.
(PeerStat): Added default value to cuid.
(calculateUploadSpeed): New function.
(updateUploadLength): New function.
(getMaxUploadSpeed): New function.
(getAvgUploadSpeed): New function.
(reset): Added uploadSpeed. Set status to IDLE.
* src/TorrentDownloadEngine.h
(cp): Declared as Time.
(sessionDownloadLengthArray): Removed.
(sessionUploadLengthArray): Removed.
(currentCp): Removed.
(lastCalcStat): New variable
(lastElapsed): Removed.
(sessionDownloadLength): Removed.
(calculateStat): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): Removed lastElapsed, cp[],
sessionDownloadLengthArray[], sessionUploadLengthArray[],
currentCp, sessionDownloadLength.
Added cp.reset() and lastCalcStat.reset().
(calculateSpeed): Changed the name of the argument.
(calculateStatistics): Rewritten.
(calculateStat): New function.
* src/Peer.h
(PeerStat.h): Included.
(peerUpload): Removed.
(peerDownload): Removed.
(peerStat): New variable.
(sessionUploadLength): New variable.
(sessionDownloadLength): New variable.
(deltaUpload): Removed.
(deltaDownload): Removed.
(resetStatus): Made private.
(Peer): Added sessionUploadLength, sessionDownloadLength.
Removed peerUpload, peerDownload.
(updateUploadLength): New function.
(addDeltaUpload): Removed.
(updateDownloadLength): New function.
(resetDeltaUpload): Removed.
(getDeltaUpload): Removed.
(addDeltaDownload): Removed.
(calculateUploadSpeed): New function.
(resetDeltaDownload): Removed.
(getDeltaDownload): Removed.
(calculateDownloadSpeed): New function.
(getSessionUploadLength): New function.
(getSessionDownloadLength): New function.
(activate): New function.
(deactivate): New function.
(addPeerUpload): Removed.
(setPeerUpload): Removed.
(getPeerUpload): Removed.
(addPeerDownload): Removed.
(setPeerDownload): Removed.
(getPeerDownload): Removed.
* src/Peer.cc
(resetStatus): Removed resetDeltaUpload() and
resetDeltaDownload().
* src/MetalinkRequestInfo.h
(MetalinkRequestInfo): Removed const qualifier from op.
* src/RequestInfo.h
(op): Removed const qualifier.
(RequestInfo): Removed const qualifier from op.
2006-09-21 13:49:06 +00:00
|
|
|
requestInfo = new MetalinkRequestInfo(op->get(PREF_METALINK_FILE),
|
|
|
|
op);
|
2006-08-07 16:05:00 +00:00
|
|
|
} else
|
|
|
|
#endif // ENABLE_METALINK
|
|
|
|
{
|
|
|
|
requestInfo = new UrlRequestInfo(args, 0, op);
|
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
while(requestInfo) {
|
|
|
|
RequestInfo* next = requestInfo->execute();
|
|
|
|
if(requestInfo->isFail()) {
|
|
|
|
delete requestInfo;
|
2006-07-03 14:19:23 +00:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
if(requestInfo->getFileInfo().checkReady()) {
|
2006-08-14 11:38:28 +00:00
|
|
|
cout << _("Now verifying checksum.\n"
|
|
|
|
"This may take some time depending on your PC environment"
|
|
|
|
" and the size of file.") << endl;
|
2006-08-07 16:05:00 +00:00
|
|
|
if(requestInfo->getFileInfo().check()) {
|
2006-08-14 11:38:28 +00:00
|
|
|
cout << _("checksum OK.") << endl;
|
2006-04-28 15:55:11 +00:00
|
|
|
} else {
|
2006-08-07 16:05:00 +00:00
|
|
|
// TODO
|
2006-08-14 11:38:28 +00:00
|
|
|
cout << _("checksum ERROR.") << endl;
|
2006-08-07 16:05:00 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-04-06 12:52:16 +00:00
|
|
|
}
|
2006-04-01 14:39:45 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
delete requestInfo;
|
|
|
|
requestInfo = next;
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
} catch(Exception* ex) {
|
|
|
|
cerr << ex->getMsg() << endl;
|
|
|
|
delete ex;
|
|
|
|
exit(EXIT_FAILURE);
|
2006-03-02 02:54:49 +00:00
|
|
|
}
|
2006-05-09 15:54:14 +00:00
|
|
|
delete op;
|
|
|
|
LogFactory::release();
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
gnutls_global_deinit();
|
|
|
|
#endif // HAVE_LIBGNUTLS
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
2006-07-03 14:19:23 +00:00
|
|
|
xmlCleanupParser();
|
2006-07-04 10:57:56 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* 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.
2006-08-03 12:36:02 +00:00
|
|
|
FeatureConfig::release();
|
2006-02-17 13:35:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|