diff --git a/ChangeLog b/ChangeLog index 75a03c70..ba858970 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +2006-05-26 Tatsuhiro Tsujikawa + + * src/PeerAbstractCommand.h + (beforeSocketCheck): Removed. + * src/PeerAbstractCommand.cc + Modified in order to call executeInternal() even if socket check + and upload limit check fail. + * src/PeerInteractionCommand.h + (keepAlive): Removed. + (sendKeepAlive): New function. + (checkHave): New function. + (beforeSocketCheck): Removed. + * src/PeerInteractionCommand.cc + (executeInternal): Use peerInteraction->checkRequestSlot(). Added + calls to checkHave() and sendKeepAlive(). + (keepAlive): Renamed to sendKeepAlive(). + (sendKeepAlive): New function. + (beforeSocketCheck): Removed. + (checkHave): New function. + * src/BitfieldMan.cc + (getMissingIndex): Don't call getMissingIndexRandomly() if max is 0. + (getMissingUnusedIndex): Don't call getMissingIndexRandomly() if max is + 0. + (getMissingIndex): Dont't call getMissingIndexRandomly() if max is 0. + * src/TorrentMan.h + (UsedPieces): Removed. + (Pieces): New type definition. + * src/Piece.h: Updated doc. + * src/Peer.h + (totalLength): Removed. + * src/Peer.cc + (updateLatency): Fixed the latency calculation. + * src/TorrentMan.cc + (addPeer): Call deleteOldErrorPeers() only if peers.size() is higher + than or equal to MAX_PEER_LIST_SIZE. + If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE, + then return false. + (deleteOldErrorPeers): Rewritten. + (deleteUsedPiece): Fixed the miss use of STL remove. + * src/PeerInteraction.h + (Pieces): Removed. + (deleteTimeoutRequestSlot): Removed. + (deleteCompletedRequestSlot): Removed. + (checkRequestSlot): New function. + * src/PeerInteraction.cc + (deleteTimeoutRequestSlot): Merged to checkRequestSlot(). + (deleteCompletedRequestSlot): Merged to checkRequestSlot(). + (checkRequestSlot): New function. + * src/DownloadEngine.cc + (run): Clear activeSockets before calling waitData(). + (waitData): Removed a call to activeSockets.clear(). + 2006-05-24 Tatsuhiro Tsujikawa To attempt to handle EINTR: diff --git a/README b/README index 7c83feb7..e4b7dcda 100644 --- a/README +++ b/README @@ -20,7 +20,7 @@ aria2 is in very early development stage. Currently it has following features: * Segmented download * Cookie support(currently aria2 ignores "expires") * It can run as a daemon process. -* BitTorrent protocol support +* BitTorrent protocol support with fast extension. * Selective download in multi-file torrent 3. How to build diff --git a/TODO b/TODO index e808c927..1dd4db50 100644 --- a/TODO +++ b/TODO @@ -15,6 +15,3 @@ * Add Message stream encryption support * Add announce-list support * Refacturing HttpConnection and FtpConnection -* HTTP/FTP downloading regression test -* Fast extension test -* compile test(OpenSSL, non-ssl, non-torrent) diff --git a/configure b/configure index e54912b3..56e5b0c8 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for aria2c 0.4.2. +# Generated by GNU Autoconf 2.59 for aria2c 0.5.0. # # Report bugs to . # @@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='aria2c' PACKAGE_TARNAME='aria2c' -PACKAGE_VERSION='0.4.2' -PACKAGE_STRING='aria2c 0.4.2' +PACKAGE_VERSION='0.5.0' +PACKAGE_STRING='aria2c 0.5.0' PACKAGE_BUGREPORT='tujikawa@rednoah.com' ac_unique_file="src/Socket.h" @@ -788,7 +788,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures aria2c 0.4.2 to adapt to many kinds of systems. +\`configure' configures aria2c 0.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -854,7 +854,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of aria2c 0.4.2:";; + short | recursive ) echo "Configuration of aria2c 0.5.0:";; esac cat <<\_ACEOF @@ -994,7 +994,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -aria2c configure 0.4.2 +aria2c configure 0.5.0 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1008,7 +1008,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by aria2c $as_me 0.4.2, which was +It was created by aria2c $as_me 0.5.0, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1651,7 +1651,7 @@ fi # Define the identity of the package. PACKAGE='aria2c' - VERSION='0.4.2' + VERSION='0.5.0' cat >>confdefs.h <<_ACEOF @@ -1917,7 +1917,6 @@ localedir=${datadir}/locale # Checks for arguments. -#AC_ARG_ENABLE([ssl], [ --enable-ssl enalbe SSL support if libssl is installed. Default: yes], [enable_ssl=$enableval], [enable_ssl=yes]) # Check whether --with-gnutls or --without-gnutls was given. if test "${with_gnutls+set}" = set; then @@ -11529,7 +11528,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by aria2c $as_me 0.4.2, which was +This file was extended by aria2c $as_me 0.5.0, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11592,7 +11591,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -aria2c config.status 0.4.2 +aria2c config.status 0.5.0 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 53b24dc0..67bc6ad6 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. # AC_PREREQ(2.59) -AC_INIT(aria2c, 0.4.2, tujikawa@rednoah.com) +AC_INIT(aria2c, 0.5.0, tujikawa@rednoah.com) AM_INIT_AUTOMAKE() AM_PATH_CPPUNIT(1.10.2) AC_CONFIG_SRCDIR([src/Socket.h]) @@ -13,7 +13,6 @@ localedir=${datadir}/locale AC_SUBST(localedir) # Checks for arguments. -#AC_ARG_ENABLE([ssl], [ --enable-ssl enalbe SSL support if libssl is installed. Default: yes], [enable_ssl=$enableval], [enable_ssl=yes]) AC_ARG_WITH([gnutls], [ --with-gnutls use gnutls library if installed. Default: yes], [with_gnutls=$enableval], [with_gnutls=yes]) AC_ARG_WITH([openssl], [ --with-openssl use openssl library if installed. Default: yes], [with_openssl=$enableval], [with_openssl=yes]) diff --git a/po/Makefile.in b/po/Makefile.in index fe9938b1..555883a9 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -9,7 +9,7 @@ # General Public License and is *not* in the public domain. PACKAGE = aria2c -VERSION = 0.4.2 +VERSION = 0.5.0 SHELL = /bin/sh diff --git a/po/aria2c.pot b/po/aria2c.pot index 8f6f93be..a67f13a5 100644 --- a/po/aria2c.pot +++ b/po/aria2c.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n" -"POT-Creation-Date: 2006-05-10 00:53+0900\n" +"POT-Creation-Date: 2006-05-27 00:27+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -342,26 +342,26 @@ msgid "" "The download was not complete because of errors. Check the log.\n" msgstr "" -#: src/main.cc:88 src/main.cc:99 +#: src/main.cc:88 msgid "" "\n" "stopping application...\n" msgstr "" -#: src/main.cc:94 src/main.cc:111 +#: src/main.cc:94 msgid "done\n" msgstr "" -#: src/main.cc:122 +#: src/main.cc:125 #, c-format msgid "Unrecognized URL or unsupported protocol: %s\n" msgstr "" -#: src/main.cc:128 +#: src/main.cc:131 msgid " version " msgstr "" -#: src/main.cc:132 +#: src/main.cc:135 msgid "" "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" @@ -378,45 +378,45 @@ msgid "" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" msgstr "" -#: src/main.cc:146 +#: src/main.cc:149 #, c-format msgid "Contact Info: %s\n" msgstr "" -#: src/main.cc:152 +#: src/main.cc:155 #, c-format msgid "Usage: %s [options] URL ...\n" msgstr "" -#: src/main.cc:154 +#: src/main.cc:157 #, c-format msgid " %s [options] -T TORRENT_FILE FILE ...\n" msgstr "" -#: src/main.cc:157 +#: src/main.cc:160 msgid "Options:" msgstr "" -#: src/main.cc:158 +#: src/main.cc:161 msgid " -d, --dir=DIR The directory to store downloaded file." msgstr "" -#: src/main.cc:159 +#: src/main.cc:162 msgid " -o, --out=FILE The file name for downloaded file." msgstr "" -#: src/main.cc:160 +#: src/main.cc:163 msgid "" " -l, --log=LOG The file path to store log. If '-' is " "specified,\n" " log is written to stdout." msgstr "" -#: src/main.cc:162 +#: src/main.cc:165 msgid " -D, --daemon Run as daemon." msgstr "" -#: src/main.cc:163 +#: src/main.cc:166 msgid "" " -s, --split=N Download a file using N connections. N must " "be\n" @@ -426,24 +426,24 @@ msgid "" " N connections." msgstr "" -#: src/main.cc:167 +#: src/main.cc:170 msgid "" " --retry-wait=SEC Set amount of time in second between requests\n" " for errors. Specify a value between 0 and 60.\n" " Default: 5" msgstr "" -#: src/main.cc:170 +#: src/main.cc:173 msgid " -t, --timeout=SEC Set timeout in second. Default: 60" msgstr "" -#: src/main.cc:171 +#: src/main.cc:174 msgid "" " -m, --max-tries=N Set number of tries. 0 means unlimited.\n" " Default: 5" msgstr "" -#: src/main.cc:173 +#: src/main.cc:176 msgid "" " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" " K or M(1K = 1024, 1M = 1024K). This\n" @@ -451,40 +451,40 @@ msgid "" " 1024." msgstr "" -#: src/main.cc:177 +#: src/main.cc:180 msgid "" " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" " URLs." msgstr "" -#: src/main.cc:179 +#: src/main.cc:182 msgid " --http-user=USER Set HTTP user. This affects to all URLs." msgstr "" -#: src/main.cc:180 +#: src/main.cc:183 msgid "" " --http-passwd=PASSWD Set HTTP password. This affects to all URLs." msgstr "" -#: src/main.cc:181 +#: src/main.cc:184 msgid "" " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" msgstr "" -#: src/main.cc:182 +#: src/main.cc:185 msgid "" " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all " "URLs." msgstr "" -#: src/main.cc:183 +#: src/main.cc:186 msgid "" " --http-proxy-method=METHOD Set the method to use in proxy request.\n" " METHOD is either 'get' or 'tunnel'.\n" " Default: tunnel" msgstr "" -#: src/main.cc:186 +#: src/main.cc:189 msgid "" " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, " "basic\n" @@ -492,23 +492,23 @@ msgid "" " Default: basic" msgstr "" -#: src/main.cc:189 +#: src/main.cc:192 msgid " --referer=REFERER Set Referer. This affects to all URLs." msgstr "" -#: src/main.cc:190 +#: src/main.cc:193 msgid "" " --ftp-user=USER Set FTP user. This affects to all URLs.\n" " Default: anonymous" msgstr "" -#: src/main.cc:192 +#: src/main.cc:195 msgid "" " --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n" " Default: ARIA2USER@" msgstr "" -#: src/main.cc:194 +#: src/main.cc:197 msgid "" " --ftp-type=TYPE Set FTP transfer type. TYPE is either " "'binary'\n" @@ -516,11 +516,11 @@ msgid "" " Default: binary" msgstr "" -#: src/main.cc:197 +#: src/main.cc:200 msgid " -p, --ftp-pasv Use passive mode in FTP." msgstr "" -#: src/main.cc:198 +#: src/main.cc:201 msgid "" " --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' " "or\n" @@ -528,11 +528,11 @@ msgid "" " Default: tunnel" msgstr "" -#: src/main.cc:202 +#: src/main.cc:205 msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file." msgstr "" -#: src/main.cc:203 +#: src/main.cc:206 msgid "" " --follow-torrent=true|false Setting this option to false prevents aria2 " "to\n" @@ -541,25 +541,25 @@ msgid "" " Default: true" msgstr "" -#: src/main.cc:207 +#: src/main.cc:210 msgid "" " -S, --show-files Print file listing of .torrent file and exit." msgstr "" -#: src/main.cc:208 +#: src/main.cc:211 msgid "" " --direct-file-mapping=true|false Directly read from and write to each file\n" " mentioned in .torrent file.\n" " Default: true" msgstr "" -#: src/main.cc:211 +#: src/main.cc:214 msgid "" " --listen-port=PORT Set port number to listen to for peer " "connection." msgstr "" -#: src/main.cc:212 +#: src/main.cc:215 msgid "" " --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries " "to\n" @@ -567,7 +567,7 @@ msgid "" "unlimited." msgstr "" -#: src/main.cc:214 +#: src/main.cc:217 msgid "" " --select-file=INDEX... Set file to download by specifing its index.\n" " You can know file index through --show-files\n" @@ -579,135 +579,135 @@ msgid "" " ',' and '-' can be used together." msgstr "" -#: src/main.cc:221 +#: src/main.cc:224 msgid " -v, --version Print the version number and exit." msgstr "" -#: src/main.cc:222 +#: src/main.cc:225 msgid " -h, --help Print this message and exit." msgstr "" -#: src/main.cc:225 +#: src/main.cc:228 msgid "" " You can specify multiple URLs. All URLs must point to the same file\n" " or downloading fails." msgstr "" -#: src/main.cc:230 +#: src/main.cc:233 msgid "" " Specify files in multi-file torrent to download. Use conjunction with\n" " -T option. This arguments are ignored if you specify --select-file option." msgstr "" -#: src/main.cc:234 +#: src/main.cc:237 msgid "Examples:" msgstr "" -#: src/main.cc:235 +#: src/main.cc:238 msgid " Download a file by 1 connection:" msgstr "" -#: src/main.cc:237 +#: src/main.cc:240 msgid " Download a file by 2 connections:" msgstr "" -#: src/main.cc:239 +#: src/main.cc:242 msgid " Download a file by 2 connections, each connects to a different server:" msgstr "" -#: src/main.cc:241 +#: src/main.cc:244 msgid " You can mix up different protocols:" msgstr "" -#: src/main.cc:244 +#: src/main.cc:247 msgid " Download a torrent:" msgstr "" -#: src/main.cc:246 +#: src/main.cc:249 msgid " Download a torrent using local .torrent file:" msgstr "" -#: src/main.cc:248 +#: src/main.cc:251 msgid " Download only selected files:" msgstr "" -#: src/main.cc:250 +#: src/main.cc:253 msgid " Print file listing of .torrent file:" msgstr "" -#: src/main.cc:254 +#: src/main.cc:257 #, c-format msgid "Report bugs to %s" msgstr "" -#: src/main.cc:350 +#: src/main.cc:353 msgid "unrecognized proxy format" msgstr "" -#: src/main.cc:377 +#: src/main.cc:380 msgid "Currently, supported authentication scheme is basic." msgstr "" -#: src/main.cc:386 +#: src/main.cc:389 msgid "retry-wait must be between 0 and 60." msgstr "" -#: src/main.cc:403 +#: src/main.cc:406 msgid "ftp-type must be either 'binary' or 'ascii'." msgstr "" -#: src/main.cc:412 +#: src/main.cc:415 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'." msgstr "" -#: src/main.cc:430 +#: src/main.cc:433 msgid "min-segment-size invalid" msgstr "" -#: src/main.cc:441 +#: src/main.cc:444 msgid "http-proxy-method must be either 'get' or 'tunnel'." msgstr "" -#: src/main.cc:449 +#: src/main.cc:452 msgid "listen-port must be between 1024 and 65535." msgstr "" -#: src/main.cc:460 +#: src/main.cc:463 msgid "follow-torrent must be either 'true' or 'false'." msgstr "" -#: src/main.cc:474 +#: src/main.cc:477 msgid "direct-file-mapping must be either 'true' or 'false'." msgstr "" -#: src/main.cc:482 +#: src/main.cc:485 msgid "upload-limit must be greater than or equal to 0." msgstr "" -#: src/main.cc:514 +#: src/main.cc:517 msgid "split must be between 1 and 5." msgstr "" -#: src/main.cc:524 +#: src/main.cc:527 msgid "timeout must be between 1 and 600" msgstr "" -#: src/main.cc:533 +#: src/main.cc:536 msgid "max-tries invalid" msgstr "" -#: src/main.cc:562 +#: src/main.cc:565 msgid "specify at least one URL" msgstr "" -#: src/main.cc:569 +#: src/main.cc:572 msgid "daemon failed" msgstr "" -#: src/main.cc:670 +#: src/main.cc:673 msgid "Files:" msgstr "" -#: src/main.cc:701 +#: src/main.cc:704 msgid "Errors occurred while binding port.\n" msgstr "" diff --git a/po/de.gmo b/po/de.gmo index 70495ec2..16f8221e 100644 Binary files a/po/de.gmo and b/po/de.gmo differ diff --git a/po/de.po b/po/de.po index ed79dac0..d8961ee2 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: de\n" "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n" -"POT-Creation-Date: 2006-05-10 00:53+0900\n" +"POT-Creation-Date: 2006-05-27 00:27+0900\n" "PO-Revision-Date: 2006-05-05 19:44+0900\n" "Last-Translator: Hermann J. Beckers \n" "Language-Team: deutsch \n" @@ -355,7 +355,7 @@ msgstr "" "\n" "Abruf wegen Fehlern nicht vollständig. Überprüfen Sie die Log-Datei.\n" -#: src/main.cc:88 src/main.cc:99 +#: src/main.cc:88 msgid "" "\n" "stopping application...\n" @@ -363,20 +363,20 @@ msgstr "" "\n" "Anwendung wird gestoppt ...\n" -#: src/main.cc:94 src/main.cc:111 +#: src/main.cc:94 msgid "done\n" msgstr "erledigt\n" -#: src/main.cc:122 +#: src/main.cc:125 #, c-format msgid "Unrecognized URL or unsupported protocol: %s\n" msgstr "URL nicht erkannt oder nicht unterstütztes Protokoll: %s\n" -#: src/main.cc:128 +#: src/main.cc:131 msgid " version " msgstr " Version " -#: src/main.cc:132 +#: src/main.cc:135 msgid "" "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" @@ -406,36 +406,36 @@ msgstr "" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" -#: src/main.cc:146 +#: src/main.cc:149 #, c-format msgid "Contact Info: %s\n" msgstr "Kontakt-Info: %s\n" -#: src/main.cc:152 +#: src/main.cc:155 #, c-format msgid "Usage: %s [options] URL ...\n" msgstr "Aufruf: %s [Optionen] URL ...\n" -#: src/main.cc:154 +#: src/main.cc:157 #, c-format msgid " %s [options] -T TORRENT_FILE FILE ...\n" msgstr " %s [Optionen] -T TORRENT_FILE FILE ...\n" -#: src/main.cc:157 +#: src/main.cc:160 msgid "Options:" msgstr "Optionen:" -#: src/main.cc:158 +#: src/main.cc:161 msgid " -d, --dir=DIR The directory to store downloaded file." msgstr "" " -d, --dir=DIR Verzeichnis zum Speichern der abgerufenen " "Datei." -#: src/main.cc:159 +#: src/main.cc:162 msgid " -o, --out=FILE The file name for downloaded file." msgstr " -o, --out=FILE Dateiname für die abgerufene Datei." -#: src/main.cc:160 +#: src/main.cc:163 msgid "" " -l, --log=LOG The file path to store log. If '-' is " "specified,\n" @@ -446,11 +446,11 @@ msgstr "" " wird das Log auf die Standardausgabe " "geschrieben." -#: src/main.cc:162 +#: src/main.cc:165 msgid " -D, --daemon Run as daemon." msgstr " -D, --daemon Start als Daemon-Prozeß." -#: src/main.cc:163 +#: src/main.cc:166 msgid "" " -s, --split=N Download a file using N connections. N must " "be\n" @@ -466,7 +466,7 @@ msgstr "" " Daher verbindet sich aria2 zu jeder URL mit\n" " N Verbindungen." -#: src/main.cc:167 +#: src/main.cc:170 msgid "" " --retry-wait=SEC Set amount of time in second between requests\n" " for errors. Specify a value between 0 and 60.\n" @@ -478,12 +478,12 @@ msgstr "" "und 60 an.\n" " Fehlwert: 5" -#: src/main.cc:170 +#: src/main.cc:173 msgid " -t, --timeout=SEC Set timeout in second. Default: 60" msgstr "" " -t, --timeout=SEC Setzt Wartezeit in Sekunden. Fehlwert: 60" -#: src/main.cc:171 +#: src/main.cc:174 msgid "" " -m, --max-tries=N Set number of tries. 0 means unlimited.\n" " Default: 5" @@ -491,7 +491,7 @@ msgstr "" " -m, --max-tries=N Anzahl Versuche. 0 bedeutet unbegrenzt.\n" " Fehlwert: 5" -#: src/main.cc:173 +#: src/main.cc:176 msgid "" " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" " K or M(1K = 1024, 1M = 1024K). This\n" @@ -504,7 +504,7 @@ msgstr "" " Wert muss größer oder gleich \n" " 1024 sein." -#: src/main.cc:177 +#: src/main.cc:180 msgid "" " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" " URLs." @@ -512,26 +512,26 @@ msgstr "" " --http-proxy=HOST:PORT HTTP-Proxyserver benutzen. Dies betrifft alle\n" " URLs." -#: src/main.cc:179 +#: src/main.cc:182 msgid " --http-user=USER Set HTTP user. This affects to all URLs." msgstr "" " --http-user=USER HTTP-Anwendername angeben. Dies betrifft alle " "URLs." -#: src/main.cc:180 +#: src/main.cc:183 msgid "" " --http-passwd=PASSWD Set HTTP password. This affects to all URLs." msgstr "" " --http-passwd=PASSWD HTTP-Passwort setzen. Dies betrifft alle URLs." -#: src/main.cc:181 +#: src/main.cc:184 msgid "" " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" msgstr "" " --http-proxy-user=USER HTTP-Proxy-Anwender setzen. Dies betrifft alle " "URLs." -#: src/main.cc:182 +#: src/main.cc:185 msgid "" " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all " "URLs." @@ -539,7 +539,7 @@ msgstr "" " --http-proxy-passwd=PASSWD HTTP-Proxy-Passwort setzen. Dies betrifft alle " "URLs." -#: src/main.cc:183 +#: src/main.cc:186 msgid "" " --http-proxy-method=METHOD Set the method to use in proxy request.\n" " METHOD is either 'get' or 'tunnel'.\n" @@ -550,7 +550,7 @@ msgstr "" " METHOD ist entweder 'get' oder 'tunnel'.\n" " Fehlwert: tunnel" -#: src/main.cc:186 +#: src/main.cc:189 msgid "" " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, " "basic\n" @@ -562,11 +562,11 @@ msgstr "" " das einzig zulässige Schema.\n" " Fehlwert: basic" -#: src/main.cc:189 +#: src/main.cc:192 msgid " --referer=REFERER Set Referer. This affects to all URLs." msgstr " --referer=REFERER Referer setzen. Dies betrifft alle URLs." -#: src/main.cc:190 +#: src/main.cc:193 msgid "" " --ftp-user=USER Set FTP user. This affects to all URLs.\n" " Default: anonymous" @@ -574,7 +574,7 @@ msgstr "" " --ftp-user=USER FTP-Anwender setzen. Dies betrifft alle URLs.\n" " Fehlwert: anonymous" -#: src/main.cc:192 +#: src/main.cc:195 msgid "" " --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n" " Default: ARIA2USER@" @@ -582,7 +582,7 @@ msgstr "" " --ftp-passwd=PASSWD FTP-Passwort setzen. Dies betrifft alle URLs.\n" " Fehlwert: ARIA2USER@" -#: src/main.cc:194 +#: src/main.cc:197 msgid "" " --ftp-type=TYPE Set FTP transfer type. TYPE is either " "'binary'\n" @@ -594,11 +594,11 @@ msgstr "" " oder 'ascii'.\n" " Fehlwert: binary" -#: src/main.cc:197 +#: src/main.cc:200 msgid " -p, --ftp-pasv Use passive mode in FTP." msgstr " -p, --ftp-pasv Passiv-Modus für FTP benutzen." -#: src/main.cc:198 +#: src/main.cc:201 msgid "" " --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' " "or\n" @@ -610,11 +610,11 @@ msgstr "" " 'tunnel'.\n" " Fehlwert: tunnel" -#: src/main.cc:202 +#: src/main.cc:205 msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file." msgstr " -T, --torrent-file=TORRENT_FILE Datenpfad zur torrent-Datei." -#: src/main.cc:203 +#: src/main.cc:206 msgid "" " --follow-torrent=true|false Setting this option to false prevents aria2 " "to\n" @@ -629,14 +629,14 @@ msgstr "" " auf .torrent endet.\n" " Fehlwert: true" -#: src/main.cc:207 +#: src/main.cc:210 msgid "" " -S, --show-files Print file listing of .torrent file and exit." msgstr "" " -S, --show-files Dateiliste der .torrent-Datei ausgeben und " "beenden." -#: src/main.cc:208 +#: src/main.cc:211 msgid "" " --direct-file-mapping=true|false Directly read from and write to each file\n" " mentioned in .torrent file.\n" @@ -646,7 +646,7 @@ msgstr "" " .torrent-Datei erwähnten Datei.\n" " Fehlwert: true" -#: src/main.cc:211 +#: src/main.cc:214 msgid "" " --listen-port=PORT Set port number to listen to for peer " "connection." @@ -654,7 +654,7 @@ msgstr "" " --listen-port=PORT Port-Nummer zum Lauschen auf Peer-Verbindungen " "setzen." -#: src/main.cc:212 +#: src/main.cc:215 msgid "" " --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries " "to\n" @@ -666,7 +666,7 @@ msgstr "" " Sendegeschwindigkeit unter SPEED zu halten. 0 " "bedeutet keine Begrenzung." -#: src/main.cc:214 +#: src/main.cc:217 msgid "" " --select-file=INDEX... Set file to download by specifing its index.\n" " You can know file index through --show-files\n" @@ -686,15 +686,15 @@ msgstr "" " Sie können auch '-' verwenden wie in \"1-5\".\n" " ',' und '-' können zusammen benutzt werden." -#: src/main.cc:221 +#: src/main.cc:224 msgid " -v, --version Print the version number and exit." msgstr " -v, --version Versionsnummer ausgeben und beenden." -#: src/main.cc:222 +#: src/main.cc:225 msgid " -h, --help Print this message and exit." msgstr " -h, --help Diese Anzeige ausgeben und beenden." -#: src/main.cc:225 +#: src/main.cc:228 msgid "" " You can specify multiple URLs. All URLs must point to the same file\n" " or downloading fails." @@ -703,7 +703,7 @@ msgstr "" "verweisen\n" "oder der Abruf schlägt fehl." -#: src/main.cc:230 +#: src/main.cc:233 msgid "" " Specify files in multi-file torrent to download. Use conjunction with\n" " -T option. This arguments are ignored if you specify --select-file option." @@ -713,117 +713,117 @@ msgstr "" " -T-Option. Diese Argumente werden ignoriert, wenn sie die Option --select-" "file angeben." -#: src/main.cc:234 +#: src/main.cc:237 msgid "Examples:" msgstr "Beispiele:" -#: src/main.cc:235 +#: src/main.cc:238 msgid " Download a file by 1 connection:" msgstr " Abruf einer Datei über 1 Verbindung:" -#: src/main.cc:237 +#: src/main.cc:240 msgid " Download a file by 2 connections:" msgstr " Abruf einer Datei mit 2 Verbindungen:" -#: src/main.cc:239 +#: src/main.cc:242 msgid " Download a file by 2 connections, each connects to a different server:" msgstr "" " Abruf einer Datei über 2 Verbindungen, jede verbindet zu einem anderen " "Server:" -#: src/main.cc:241 +#: src/main.cc:244 msgid " You can mix up different protocols:" msgstr " Sie können verschiedene Protokolle mischen:" -#: src/main.cc:244 +#: src/main.cc:247 msgid " Download a torrent:" msgstr " Einen torrent abrufen:" -#: src/main.cc:246 +#: src/main.cc:249 msgid " Download a torrent using local .torrent file:" msgstr " Einen torrent mit einer lokalen .torrent-Datei abrufen:" -#: src/main.cc:248 +#: src/main.cc:251 msgid " Download only selected files:" msgstr " Nur ausgewählte Dateien abrufen:" -#: src/main.cc:250 +#: src/main.cc:253 msgid " Print file listing of .torrent file:" msgstr " Dateiliste einer .torrent-Datei ausgeben:" -#: src/main.cc:254 +#: src/main.cc:257 #, c-format msgid "Report bugs to %s" msgstr "Fehler an %s melden" -#: src/main.cc:350 +#: src/main.cc:353 msgid "unrecognized proxy format" msgstr "nicht erkanntes Proxy-Format" -#: src/main.cc:377 +#: src/main.cc:380 msgid "Currently, supported authentication scheme is basic." msgstr "Derzeit unterstütztes Authentifizierungsschema ist basic." -#: src/main.cc:386 +#: src/main.cc:389 msgid "retry-wait must be between 0 and 60." msgstr "retry-wait muss zwischen 0 und 60 liegen." -#: src/main.cc:403 +#: src/main.cc:406 msgid "ftp-type must be either 'binary' or 'ascii'." msgstr "ftp-type muss entweder 'binary' oder 'ascii' sein." -#: src/main.cc:412 +#: src/main.cc:415 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'." msgstr "ftp-via-http-proxy muss entweder 'get' oder 'tunnel' sein." -#: src/main.cc:430 +#: src/main.cc:433 msgid "min-segment-size invalid" msgstr "min-segment-size ungültig" -#: src/main.cc:441 +#: src/main.cc:444 msgid "http-proxy-method must be either 'get' or 'tunnel'." msgstr "http-proxy-method muss entweder 'get' oder 'tunnel' sein." -#: src/main.cc:449 +#: src/main.cc:452 msgid "listen-port must be between 1024 and 65535." msgstr "listen-port muss zwischen 1024 und 65535 liegen." -#: src/main.cc:460 +#: src/main.cc:463 msgid "follow-torrent must be either 'true' or 'false'." msgstr "follow-torrent muss entweder 'true' oder 'false' sein." -#: src/main.cc:474 +#: src/main.cc:477 msgid "direct-file-mapping must be either 'true' or 'false'." msgstr "direct-file-mapping muss entweder 'true' oder 'false' sein." -#: src/main.cc:482 +#: src/main.cc:485 msgid "upload-limit must be greater than or equal to 0." msgstr "upload-limit muss größer oder gleich 0 sein." -#: src/main.cc:514 +#: src/main.cc:517 msgid "split must be between 1 and 5." msgstr "split muss zwischen 1 und 5 liegen." -#: src/main.cc:524 +#: src/main.cc:527 msgid "timeout must be between 1 and 600" msgstr "timeout muss zwischen 1 und 600 liegen." -#: src/main.cc:533 +#: src/main.cc:536 msgid "max-tries invalid" msgstr "max-tries ungültig" -#: src/main.cc:562 +#: src/main.cc:565 msgid "specify at least one URL" msgstr "Geben Sie zumindest eine URL an" -#: src/main.cc:569 +#: src/main.cc:572 msgid "daemon failed" msgstr "Daemon-Start nicht erfolgreich" -#: src/main.cc:670 +#: src/main.cc:673 msgid "Files:" msgstr "Dateien:" -#: src/main.cc:701 +#: src/main.cc:704 msgid "Errors occurred while binding port.\n" msgstr "Fehler beim Binden an Port aufgetreten.\n" diff --git a/po/ja.gmo b/po/ja.gmo index 74ea8b22..e0f3598d 100644 Binary files a/po/ja.gmo and b/po/ja.gmo differ diff --git a/po/ja.po b/po/ja.po index ca16f620..bbae488f 100644 --- a/po/ja.po +++ b/po/ja.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: aria2c 0.2.1\n" "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n" -"POT-Creation-Date: 2006-05-10 00:53+0900\n" -"PO-Revision-Date: 2006-05-05 19:45+0900\n" +"POT-Creation-Date: 2006-05-27 00:27+0900\n" +"PO-Revision-Date: 2006-05-27 00:25+0900\n" "Last-Translator: Tatsuhiro Tsujikawa \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" @@ -358,7 +358,7 @@ msgstr "" "\n" "¥À¥¦¥ó¥í¡¼¥É¤Ï¥¨¥é¡¼¤Î¤¿¤á´°Î»¤·¤Æ¤¤¤Þ¤»¤ó. ¥í¥°¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤.\n" -#: src/main.cc:88 src/main.cc:99 +#: src/main.cc:88 msgid "" "\n" "stopping application...\n" @@ -366,22 +366,22 @@ msgstr "" "\n" "¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò½ªÎ»¤·¤Æ¤¤¤Þ¤¹...\n" -#: src/main.cc:94 src/main.cc:111 +#: src/main.cc:94 msgid "done\n" msgstr "´°Î»\n" -#: src/main.cc:122 +#: src/main.cc:125 #, c-format msgid "Unrecognized URL or unsupported protocol: %s\n" msgstr "" "%s ¤Ï, Íý²ò¤Ç¤­¤Ê¤¤ URL ¥Õ¥©¡¼¥Þ¥Ã¥È, ¤Þ¤¿¤Ï, ¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤¥×¥í¥È¥³¥ë¤Ç" "¤¹.\n" -#: src/main.cc:128 +#: src/main.cc:131 msgid " version " msgstr " ¥Ð¡¼¥¸¥ç¥ó " -#: src/main.cc:132 +#: src/main.cc:135 msgid "" "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" @@ -397,51 +397,50 @@ msgid "" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" msgstr "" -"¤³¤Î¥×¥í¥°¥é¥à¤Ï¥Õ¥ê¡¼¥½¥Õ¥È¥¦¥§¥¢¤Ç¤¹¡£¤¢¤Ê¤¿¤Ï¤³¤ì¤ò¡¢¥Õ¥ê¡¼¥½¥Õ¥È¥¦¥§\n" -"¥¢ºâÃĤˤè¤Ã¤ÆÈ¯¹Ô¤µ¤ì¤¿ GNU °ìÈ̸ø½°ÍøÍѵöÂú·ÀÌó½ñ(¥Ð¡¼¥¸¥ç¥ó2¤«¡¢´õ\n" -"˾¤Ë¤è¤Ã¤Æ¤Ï¤½¤ì°Ê¹ß¤Î¥Ð¡¼¥¸¥ç¥ó¤Î¤¦¤Á¤É¤ì¤«)¤ÎÄê¤á¤ë¾ò·ï¤Î²¼¤ÇºÆÈÒÉÛ\n" -"¤Þ¤¿¤Ï²þÊѤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£\n" +"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" -"¤³¤Î¥×¥í¥°¥é¥à¤ÏÍ­ÍѤǤ¢¤ë¤³¤È¤ò´ê¤Ã¤ÆÈÒÉÛ¤µ¤ì¤Þ¤¹¤¬¡¢*Á´¤¯¤Î̵ÊݾÚ* \n" -"¤Ç¤¹¡£¾¦¶È²ÄǽÀ­¤ÎÊݾڤäÆÃÄê¤ÎÌÜŪ¤Ø¤ÎŬ¹çÀ­¤Ï¡¢¸À³°¤Ë¼¨¤µ¤ì¤¿¤â¤Î¤â´Þ\n" -"¤áÁ´¤¯Â¸ºß¤·¤Þ¤»¤ó¡£¾Ü¤·¤¯¤ÏGNU °ìÈ̸ø½°ÍøÍѵöÂú·ÀÌó½ñ¤ò¤´Í÷¤¯¤À¤µ¤¤¡£\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" -"¤¢¤Ê¤¿¤Ï¤³¤Î¥×¥í¥°¥é¥à¤È¶¦¤Ë¡¢GNU °ìÈ̸ø½°ÍøÍѵöÂú·ÀÌó½ñ¤ÎÊ£À½Êª¤ò°ìÉô\n" -"¼õ¤±¼è¤Ã¤¿¤Ï¤º¤Ç¤¹¡£¤â¤·¼õ¤±¼è¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢¥Õ¥ê¡¼¥½¥Õ¥È¥¦¥§¥¢ºâÃĤÞ\n" -"¤ÇÀÁµá¤·¤Æ¤¯¤À¤µ¤¤(°¸Àè¤Ï the Free Software Foundation, Inc., 59\n" -"Temple Place, Suite 330, Boston, MA 02111-1307 USA)¡£\n" -"(Ìõ: http://www.opensource.jp/gpl/gpl.ja.html.euc-jp)\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" +"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" -#: src/main.cc:146 +#: src/main.cc:149 #, c-format msgid "Contact Info: %s\n" msgstr "Ï¢ÍíÀè: %s\n" -#: src/main.cc:152 +#: src/main.cc:155 #, c-format msgid "Usage: %s [options] URL ...\n" msgstr "»È¤¤Êý: %s [¥ª¥×¥·¥ç¥ó] URL ...\n" -#: src/main.cc:154 +#: src/main.cc:157 #, c-format msgid " %s [options] -T TORRENT_FILE FILE ...\n" msgstr " %s [¥ª¥×¥·¥ç¥ó] -T TORRENT_FILE FILE ...\n" -#: src/main.cc:157 +#: src/main.cc:160 msgid "Options:" msgstr "¥ª¥×¥·¥ç¥ó:" -#: src/main.cc:158 +#: src/main.cc:161 msgid " -d, --dir=DIR The directory to store downloaded file." msgstr "" " -d, --dir=DIR ¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ë¤òÊݸ¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê." -#: src/main.cc:159 +#: src/main.cc:162 msgid " -o, --out=FILE The file name for downloaded file." msgstr "" " -o, --out=FILE ¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ë¤ÎÊݸÀè¥Õ¥¡¥¤¥ë̾." -#: src/main.cc:160 +#: src/main.cc:163 msgid "" " -l, --log=LOG The file path to store log. If '-' is " "specified,\n" @@ -451,11 +450,11 @@ msgstr "" "ÎÏ\n" " ¤Ë½ÐÎϤ·¤Þ¤¹." -#: src/main.cc:162 +#: src/main.cc:165 msgid " -D, --daemon Run as daemon." msgstr " -D, --daemon ¥Ç¡¼¥â¥ó¤È¤·¤Æµ¯Æ°¤·¤Þ¤¹." -#: src/main.cc:163 +#: src/main.cc:166 msgid "" " -s, --split=N Download a file using N connections. N must " "be\n" @@ -474,7 +473,7 @@ msgstr "" "¥·¥ç\n" " ¥ó¤ò³ÎΩ¤·¤Þ¤¹." -#: src/main.cc:167 +#: src/main.cc:170 msgid "" " --retry-wait=SEC Set amount of time in second between requests\n" " for errors. Specify a value between 0 and 60.\n" @@ -485,13 +484,13 @@ msgstr "" " ¤¹. 0 - 60 ¤ÎÃͤò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: 5" -#: src/main.cc:170 +#: src/main.cc:173 msgid " -t, --timeout=SEC Set timeout in second. Default: 60" msgstr "" " -t, --timeout=SEC ¥¿¥¤¥à¥¢¥¦¥È¤È¤Ê¤ë»þ´Ö¤òÉäǻØÄꤷ¤Þ¤¹.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: 60" -#: src/main.cc:171 +#: src/main.cc:174 msgid "" " -m, --max-tries=N Set number of tries. 0 means unlimited.\n" " Default: 5" @@ -500,7 +499,7 @@ msgstr "" "¹Ô\n" " ¤·¤Þ¤¹. ¥Ç¥Õ¥©¥ë¥ÈÃÍ: 5" -#: src/main.cc:173 +#: src/main.cc:176 msgid "" " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" " K or M(1K = 1024, 1M = 1024K). This\n" @@ -513,7 +512,7 @@ msgstr "" "1024K).\n" " 1024 °Ê¾å¤ÎÃͤò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:177 +#: src/main.cc:180 msgid "" " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" " URLs." @@ -522,14 +521,14 @@ msgstr "" "¥·\n" " ¥ç¥ó¤Ï¤¹¤Ù¤Æ¤Î URL ¤Ë±Æ¶Á¤·¤Þ¤¹." -#: src/main.cc:179 +#: src/main.cc:182 msgid " --http-user=USER Set HTTP user. This affects to all URLs." msgstr "" " --http-user=USER HTTP ¤Ç¤Îǧ¾Ú¥æ¡¼¥¶¡¼¤ò»ØÄꤷ¤Þ¤¹. ¤³¤Î¥ª¥×¥·¥ç" "¥ó\n" " ¤Ï¤¹¤Ù¤Æ¤Î URL ¤Ë±Æ¶Á¤·¤Þ¤¹." -#: src/main.cc:180 +#: src/main.cc:183 msgid "" " --http-passwd=PASSWD Set HTTP password. This affects to all URLs." msgstr "" @@ -537,7 +536,7 @@ msgstr "" "¥·¥ç\n" " ¥ó¤Ï¤¹¤Ù¤Æ¤Î URL ¤Ë±Æ¶Á¤·¤Þ¤¹." -#: src/main.cc:181 +#: src/main.cc:184 msgid "" " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" msgstr "" @@ -547,7 +546,7 @@ msgstr "" "¤Þ\n" " ¤¹." -#: src/main.cc:182 +#: src/main.cc:185 msgid "" " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all " "URLs." @@ -558,7 +557,7 @@ msgstr "" "¤·\n" " ¤Þ¤¹." -#: src/main.cc:183 +#: src/main.cc:186 msgid "" " --http-proxy-method=METHOD Set the method to use in proxy request.\n" " METHOD is either 'get' or 'tunnel'.\n" @@ -569,7 +568,7 @@ msgstr "" " ¤¹. 'get' ¤Þ¤¿¤Ï 'tunnel' ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: tunnel" -#: src/main.cc:186 +#: src/main.cc:189 msgid "" " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, " "basic\n" @@ -581,14 +580,14 @@ msgstr "" " ¤¤¤ë¤Î¤Ï basic ¤Ç¤¹. \n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: basic" -#: src/main.cc:189 +#: src/main.cc:192 msgid " --referer=REFERER Set Referer. This affects to all URLs." msgstr "" " --referer=REFERER ¥ê¥Õ¥¡¥é¡¼¤ò»ØÄꤷ¤Þ¤¹. ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¹¤Ù¤Æ" "¤Î\n" " URL ¤Ë±Æ¶Á¤·¤Þ¤¹." -#: src/main.cc:190 +#: src/main.cc:193 msgid "" " --ftp-user=USER Set FTP user. This affects to all URLs.\n" " Default: anonymous" @@ -598,7 +597,7 @@ msgstr "" " ¤Ï¤¹¤Ù¤Æ¤Î URL ¤Ë±Æ¶Á¤·¤Þ¤¹.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: anonymous" -#: src/main.cc:192 +#: src/main.cc:195 msgid "" " --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n" " Default: ARIA2USER@" @@ -608,7 +607,7 @@ msgstr "" " ¥ó¤Ï¤¹¤Ù¤Æ¤Î URL ¤Ë±Æ¶Á¤·¤Þ¤¹.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: ARIA2USER@" -#: src/main.cc:194 +#: src/main.cc:197 msgid "" " --ftp-type=TYPE Set FTP transfer type. TYPE is either " "'binary'\n" @@ -619,11 +618,11 @@ msgstr "" " 'ascii' ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤. ¥Ç¥Õ¥©¥ë¥ÈÃÍ: " "binary" -#: src/main.cc:197 +#: src/main.cc:200 msgid " -p, --ftp-pasv Use passive mode in FTP." msgstr " -p, --ftp-pasv FTP ¤Ç passive ¥â¡¼¥É¤ò»ÈÍѤ·¤Þ¤¹." -#: src/main.cc:198 +#: src/main.cc:201 msgid "" " --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' " "or\n" @@ -636,11 +635,11 @@ msgstr "" "¤¯\n" " ¤À¤µ¤¤. ¥Ç¥Õ¥©¥ë¥ÈÃÍ: tunnel" -#: src/main.cc:202 +#: src/main.cc:205 msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file." msgstr " -T, --torrent-file=TORRENT_FILE .torrent ¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê." -#: src/main.cc:203 +#: src/main.cc:206 msgid "" " --follow-torrent=true|false Setting this option to false prevents aria2 " "to\n" @@ -655,7 +654,7 @@ msgstr "" " ¤Ï, BitTorrent ¥â¡¼¥É¤ËÆþ¤ê¤Þ¤»¤ó.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: true" -#: src/main.cc:207 +#: src/main.cc:210 msgid "" " -S, --show-files Print file listing of .torrent file and exit." msgstr "" @@ -663,7 +662,7 @@ msgstr "" "¤·\n" " ½ªÎ»¤·¤Þ¤¹." -#: src/main.cc:208 +#: src/main.cc:211 msgid "" " --direct-file-mapping=true|false Directly read from and write to each file\n" " mentioned in .torrent file.\n" @@ -674,14 +673,14 @@ msgstr "" " ¤·¤Þ¤¹.\n" " ¥Ç¥Õ¥©¥ë¥ÈÃÍ: true" -#: src/main.cc:211 +#: src/main.cc:214 msgid "" " --listen-port=PORT Set port number to listen to for peer " "connection." msgstr "" " --listen-port=PORT ¥Ô¥¢¤«¤é¤ÎÀܳ¤ò¼õ¤±ÉÕ¤±¤ë¥Ý¡¼¥ÈÈÖ¹æ¤ò»ØÄê." -#: src/main.cc:212 +#: src/main.cc:215 msgid "" " --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries " "to\n" @@ -694,7 +693,7 @@ msgstr "" "¤·\n" " ¤Þ¤¹. 0 ¤Ï®ÅÙ̵À©¸Â¤ò°ÕÌ£¤·¤Þ¤¹." -#: src/main.cc:214 +#: src/main.cc:217 msgid "" " --select-file=INDEX... Set file to download by specifing its index.\n" " You can know file index through --show-files\n" @@ -715,16 +714,16 @@ msgstr "" " ¤Þ¤¿, '-' ¤ò»È¤Ã¤ÆÈϰϻØÄê¤â¤Ç¤­¤Þ¤¹: \"1-5\"\n" " ',' ¤È '-' ¤ÏÁȤ߹ç¤ï¤»¤Æ»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹." -#: src/main.cc:221 +#: src/main.cc:224 msgid " -v, --version Print the version number and exit." msgstr " -v, --version ¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤·, ½ªÎ»¤·¤Þ¤¹." -#: src/main.cc:222 +#: src/main.cc:225 msgid " -h, --help Print this message and exit." msgstr "" " -h, --help ¤³¤Î¥Ø¥ë¥×¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤·, ½ªÎ»¤·¤Þ¤¹." -#: src/main.cc:225 +#: src/main.cc:228 msgid "" " You can specify multiple URLs. All URLs must point to the same file\n" " or downloading fails." @@ -733,7 +732,7 @@ msgstr "" "¤ì\n" " ¤Ð¤Ê¤ê¤Þ¤»¤ó. ¤µ¤â¤Ê¤¯¤Ð¥À¥¦¥ó¥í¡¼¥É¤Ï¼ºÇÔ¤·¤Þ¤¹." -#: src/main.cc:230 +#: src/main.cc:233 msgid "" " Specify files in multi-file torrent to download. Use conjunction with\n" " -T option. This arguments are ignored if you specify --select-file option." @@ -742,115 +741,115 @@ msgstr "" "¥ó\n" " ¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹. --select-file ¥ª¥×¥·¥ç¥ó¤ÈÊ»ÍѤϤǤ­¤Þ¤»¤ó." -#: src/main.cc:234 +#: src/main.cc:237 msgid "Examples:" msgstr "Îã:" -#: src/main.cc:235 +#: src/main.cc:238 msgid " Download a file by 1 connection:" msgstr " 1 ¥³¥Í¥¯¥·¥ç¥ó¤Ç¤Î¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:237 +#: src/main.cc:240 msgid " Download a file by 2 connections:" msgstr " 2 ¥³¥Í¥¯¥·¥ç¥ó¤Ç¤Î¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:239 +#: src/main.cc:242 msgid " Download a file by 2 connections, each connects to a different server:" msgstr " Æó¤Ä¤Î°Û¤Ê¤ë¥µ¡¼¥Ð¡¼¤ËÀܳ¤·¤Æ¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:241 +#: src/main.cc:244 msgid " You can mix up different protocols:" msgstr " °Û¤Ê¤ë¥×¥í¥È¥³¥ë¤òº®¹ç¤µ¤»¤Æ¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:244 +#: src/main.cc:247 msgid " Download a torrent:" msgstr "torrent ¤ò¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:246 +#: src/main.cc:249 msgid " Download a torrent using local .torrent file:" msgstr " ¥í¡¼¥«¥ë .torrent ¥Õ¥¡¥¤¥ë¤ò»È¤Ã¤Æ¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:248 +#: src/main.cc:251 msgid " Download only selected files:" msgstr " ¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Æ¥À¥¦¥ó¥í¡¼¥É:" -#: src/main.cc:250 +#: src/main.cc:253 msgid " Print file listing of .torrent file:" msgstr " ¤³¤Î .torrent ¥Õ¥¡¥¤¥ë¤Ë´Þ¤Þ¤ì¤ë¥Õ¥¡¥¤¥ë¥ê¥¹¥È¤òɽ¼¨:" -#: src/main.cc:254 +#: src/main.cc:257 #, c-format msgid "Report bugs to %s" msgstr "¥Ð¥°¥ì¥Ý¡¼¥È¤Ï¤³¤Á¤é¤Ø: %s" -#: src/main.cc:350 +#: src/main.cc:353 msgid "unrecognized proxy format" msgstr "Íý²ò¤Ç¤­¤Ê¤¤Proxy¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¤¹." -#: src/main.cc:377 +#: src/main.cc:380 msgid "Currently, supported authentication scheme is basic." msgstr "¸½ºß¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ëǧ¾ÚÊýË¡¤Ï basic ¤Ç¤¹." -#: src/main.cc:386 +#: src/main.cc:389 msgid "retry-wait must be between 0 and 60." msgstr "retry-wait ¤Ï 0 ¤«¤é 60 ¤Î´Ö¤Ç»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:403 +#: src/main.cc:406 msgid "ftp-type must be either 'binary' or 'ascii'." msgstr "ftp-type ¤Ï 'binary' ¤Þ¤¿¤Ï 'ascii' ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:412 +#: src/main.cc:415 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'." msgstr "ftp-via-http-proxy ¤Ï 'get' ¤Þ¤¿¤Ï 'tunnel' ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:430 +#: src/main.cc:433 msgid "min-segment-size invalid" msgstr "min-segment-size ¤¬ÉÔÀµ¤Ç¤¹." -#: src/main.cc:441 +#: src/main.cc:444 msgid "http-proxy-method must be either 'get' or 'tunnel'." msgstr "http-proxy-method ¤Ï 'get' ¤Þ¤¿¤Ï 'tunnel' ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:449 +#: src/main.cc:452 msgid "listen-port must be between 1024 and 65535." msgstr "listen-port ¤Ï 1024 - 65535 ¤ÎÃͤò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:460 +#: src/main.cc:463 msgid "follow-torrent must be either 'true' or 'false'." msgstr "follow-torrent ¤Ï 'true' ¤Þ¤¿¤Ï 'false ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:474 +#: src/main.cc:477 msgid "direct-file-mapping must be either 'true' or 'false'." msgstr "direct-file-mapping ¤Ï 'true' ¤Þ¤¿¤Ï 'false ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:482 +#: src/main.cc:485 msgid "upload-limit must be greater than or equal to 0." msgstr "upload-limit ¤Ï 0 °Ê¾å¤Î¿ô¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:514 +#: src/main.cc:517 msgid "split must be between 1 and 5." msgstr "split ¤Ï 1 - 5 ¤ÎÃͤò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:524 +#: src/main.cc:527 msgid "timeout must be between 1 and 600" msgstr "timeout ¤Ï 1 - 600 ¤ÎÃͤò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:533 +#: src/main.cc:536 msgid "max-tries invalid" msgstr "max-tries ¤¬ÉÔÀµ¤Ç¤¹." -#: src/main.cc:562 +#: src/main.cc:565 msgid "specify at least one URL" msgstr "°ì¸Ä°Ê¾å¤Î URL ¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤." -#: src/main.cc:569 +#: src/main.cc:572 msgid "daemon failed" msgstr "¥Ç¡¼¥â¥óµ¯Æ°¤Ë¼ºÇÔ" -#: src/main.cc:670 +#: src/main.cc:673 msgid "Files:" msgstr "¥Õ¥¡¥¤¥ë:" -#: src/main.cc:701 +#: src/main.cc:704 msgid "Errors occurred while binding port.\n" msgstr "¥Ý¡¼¥È¤ò¥Ð¥¤¥ó¥ÉÃæ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿.\n" diff --git a/src/BitfieldMan.cc b/src/BitfieldMan.cc index 0e32f912..c43b0dc5 100644 --- a/src/BitfieldMan.cc +++ b/src/BitfieldMan.cc @@ -188,7 +188,10 @@ int BitfieldMan::getMissingIndex(const unsigned char* peerBitfield, int length) } } int max = countSetBit(tempBitfield, bitfieldLength); - int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); + int index = -1; + if(max > 0) { + index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); + } delete [] tempBitfield; return index; } @@ -205,7 +208,10 @@ int BitfieldMan::getMissingUnusedIndex(const unsigned char* peerBitfield, int le } } int max = countSetBit(tempBitfield, bitfieldLength); - int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); + int index = -1; + if(max > 0) { + index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); + } delete [] tempBitfield; return index; } @@ -254,7 +260,10 @@ int BitfieldMan::getMissingIndex() const { } } int max = countSetBit(tempBitfield, bitfieldLength); - int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); + int index = -1; + if(max > 0) { + index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); + } delete [] tempBitfield; return index; } diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index 645b691a..ecb6551c 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -80,7 +80,7 @@ void DownloadEngine::run() { } } afterEachIteration(); - //shortSleep(); + activeSockets.clear(); if(!noWait && !commands.empty()) { waitData(activeSockets); } @@ -100,7 +100,6 @@ void DownloadEngine::shortSleep() const { } void DownloadEngine::waitData(Sockets& activeSockets) { - activeSockets.clear(); fd_set rfds; fd_set wfds; int retval = 0; diff --git a/src/Peer.cc b/src/Peer.cc index 28099c45..7d556f48 100644 --- a/src/Peer.cc +++ b/src/Peer.cc @@ -79,5 +79,5 @@ void Peer::setAllBitfield() { } void Peer::updateLatency(int latency) { - this->latency = (this->latency*80+latency*20)/200; + this->latency = (this->latency*20+latency*80)/200; } diff --git a/src/Peer.h b/src/Peer.h index 959ded33..53707cd5 100644 --- a/src/Peer.h +++ b/src/Peer.h @@ -55,7 +55,6 @@ private: long long int peerUpload; long long int peerDownload; int pieceLength; - long long int totalLength; int deltaUpload; int deltaDownload; int latency; @@ -69,7 +68,7 @@ public: bitfield(NULL), fastExtensionEnabled(false), peerUpload(0), peerDownload(0), - pieceLength(pieceLength), totalLength(totalLength), + pieceLength(pieceLength), deltaUpload(0), deltaDownload(0), latency(DEFAULT_LATENCY) { this->bitfield = new BitfieldMan(pieceLength, totalLength); diff --git a/src/PeerAbstractCommand.cc b/src/PeerAbstractCommand.cc index 7008c2d9..74a6617f 100644 --- a/src/PeerAbstractCommand.cc +++ b/src/PeerAbstractCommand.cc @@ -78,24 +78,19 @@ bool PeerAbstractCommand::execute() { return true; } try { - beforeSocketCheck(); if(uploadLimitCheck && (uploadLimit == 0 || e->getUploadSpeed() <= uploadLimit*1024) || checkSocketIsReadable && readCheckTarget->isReadable(0) || - checkSocketIsWritable && writeCheckTarget->isWritable(0) || - !checkSocketIsReadable && !checkSocketIsWritable) { + checkSocketIsWritable && writeCheckTarget->isWritable(0)) { updateCheckPoint(); - return executeInternal(); - } else { - if(isTimeoutDetected()) { - // TODO - checkPoint.tv_sec = 0; - checkPoint.tv_usec = 0; - throw new DlRetryEx(EX_TIME_OUT); - } - e->commands.push_back(this); - return false; } + if(isTimeoutDetected()) { + // TODO following 2 lines will be deleted. + checkPoint.tv_sec = 0; + checkPoint.tv_usec = 0; + throw new DlRetryEx(EX_TIME_OUT); + } + return executeInternal(); } catch(Exception* err) { logger->error(MSG_DOWNLOAD_ABORTED, err, cuid); onAbort(err); diff --git a/src/PeerAbstractCommand.h b/src/PeerAbstractCommand.h index 3bf5bd7b..a6310c01 100644 --- a/src/PeerAbstractCommand.h +++ b/src/PeerAbstractCommand.h @@ -42,7 +42,6 @@ protected: virtual bool prepareForRetry(int wait); virtual void onAbort(Exception* ex); virtual bool executeInternal() = 0; - virtual void beforeSocketCheck() {} void setReadCheckSocket(Socket* socket); void setWriteCheckSocket(Socket* socket); void setUploadLimit(int uploadLimit); diff --git a/src/PeerConnection.h b/src/PeerConnection.h index 523865ef..31b8fbdd 100644 --- a/src/PeerConnection.h +++ b/src/PeerConnection.h @@ -28,6 +28,7 @@ #include "TorrentMan.h" #include "PeerMessage.h" #include "HandshakeMessage.h" +#include "common.h" // we assume maximum length of incoming message is "piece" message with 16KB // data. Messages beyond that size are dropped. diff --git a/src/PeerInteraction.cc b/src/PeerInteraction.cc index cff7e5bc..90520248 100644 --- a/src/PeerInteraction.cc +++ b/src/PeerInteraction.cc @@ -219,7 +219,7 @@ void PeerInteraction::deleteRequestSlot(const RequestSlot& requestSlot) { } } -void PeerInteraction::deleteTimeoutRequestSlot() { +void PeerInteraction::checkRequestSlot() { for(RequestSlots::iterator itr = requestSlots.begin(); itr != requestSlots.end();) { RequestSlot& slot = *itr; @@ -232,32 +232,24 @@ void PeerInteraction::deleteTimeoutRequestSlot() { piece.cancelBlock(slot.getBlockIndex()); itr = requestSlots.erase(itr); } else { - itr++; + Piece piece = getDownloadPiece(slot.getIndex()); + if(piece.hasBlock(slot.getBlockIndex()) || + torrentMan->hasPiece(piece.getIndex())) { + logger->debug("CUID#%d - Deleting request slot blockIndex=%d because" + " the block has been acquired.", cuid, + slot.getBlockIndex()); + addMessage(createCancelMessage(slot.getIndex(), + slot.getBegin(), + slot.getLength())); + itr = requestSlots.erase(itr); + } else { + itr++; + } } } updatePiece(); } -void PeerInteraction::deleteCompletedRequestSlot() { - for(RequestSlots::iterator itr = requestSlots.begin(); - itr != requestSlots.end();) { - RequestSlot& slot = *itr; - Piece piece = getDownloadPiece(slot.getIndex()); - if(piece.hasBlock(slot.getBlockIndex()) || - torrentMan->hasPiece(piece.getIndex())) { - logger->debug("CUID#%d - Deleting request slot blockIndex=%d because" - " the block has been acquired.", cuid, - slot.getBlockIndex()); - addMessage(createCancelMessage(slot.getIndex(), - slot.getBegin(), - slot.getLength())); - itr = requestSlots.erase(itr); - } else { - itr++; - } - } -} - bool PeerInteraction::isInRequestSlot(int index, int blockIndex) const { for(RequestSlots::const_iterator itr = requestSlots.begin(); itr != requestSlots.end(); itr++) { @@ -469,7 +461,7 @@ void PeerInteraction::addRequests() { } } int MAX_PENDING_REQUEST; - if(peer->getLatency() < 900) { + if(peer->getLatency() < 500) { MAX_PENDING_REQUEST = 24; } else if(peer->getLatency() < 1500) { MAX_PENDING_REQUEST = 12; diff --git a/src/PeerInteraction.h b/src/PeerInteraction.h index 079a4973..06a576d5 100644 --- a/src/PeerInteraction.h +++ b/src/PeerInteraction.h @@ -48,7 +48,6 @@ typedef deque RequestSlots; typedef deque MessageQueue; -typedef deque Pieces; class PeerInteraction { private: @@ -87,8 +86,7 @@ public: bool isSendingMessageInProgress() const; void deleteRequestSlot(const RequestSlot& requestSlot); - void deleteTimeoutRequestSlot(); - void deleteCompletedRequestSlot(); + void checkRequestSlot(); RequestSlot getCorrespondingRequestSlot(int index, int begin, int length) const; bool isInRequestSlot(int index, int blockIndex) const; diff --git a/src/PeerInteractionCommand.cc b/src/PeerInteractionCommand.cc index 3137602e..aafeed58 100644 --- a/src/PeerInteractionCommand.cc +++ b/src/PeerInteractionCommand.cc @@ -115,12 +115,12 @@ bool PeerInteractionCommand::executeInternal() { decideChoking(); receiveMessages(); detectMessageFlooding(); - //checkLongTimePeerChoking(); - peerInteraction->deleteTimeoutRequestSlot(); - peerInteraction->deleteCompletedRequestSlot(); + peerInteraction->checkRequestSlot(); peerInteraction->addRequests(); + checkHave(); peerInteraction->sendMessages(e->getUploadSpeed()); + sendKeepAlive(); break; } if(peerInteraction->countMessageInQueue() > 0) { @@ -250,7 +250,7 @@ void PeerInteractionCommand::onAbort(Exception* ex) { PeerAbstractCommand::onAbort(ex); } -void PeerInteractionCommand::keepAlive() { +void PeerInteractionCommand::sendKeepAlive() { if(keepAliveCheckPoint.tv_sec == 0 && keepAliveCheckPoint.tv_usec == 0) { gettimeofday(&keepAliveCheckPoint, NULL); } else { @@ -266,27 +266,22 @@ void PeerInteractionCommand::keepAlive() { } } -void PeerInteractionCommand::beforeSocketCheck() { - if(sequence == WIRED) { - e->torrentMan->unadvertisePiece(cuid); - detectMessageFlooding(); - //checkLongTimePeerChoking(); - PieceIndexes indexes = e->torrentMan->getAdvertisedPieceIndexes(cuid); - if(indexes.size() >= 20) { - if(peer->isFastExtensionEnabled()) { - if(e->torrentMan->hasAllPieces()) { - peerInteraction->addMessage(peerInteraction->createHaveAllMessage()); - } else { - peerInteraction->addMessage(peerInteraction->createBitfieldMessage()); - } +void PeerInteractionCommand::checkHave() { + e->torrentMan->unadvertisePiece(cuid); + PieceIndexes indexes = e->torrentMan->getAdvertisedPieceIndexes(cuid); + if(indexes.size() >= 20) { + if(peer->isFastExtensionEnabled()) { + if(e->torrentMan->hasAllPieces()) { + peerInteraction->addMessage(peerInteraction->createHaveAllMessage()); } else { peerInteraction->addMessage(peerInteraction->createBitfieldMessage()); } } else { - for(PieceIndexes::iterator itr = indexes.begin(); itr != indexes.end(); itr++) { - peerInteraction->addMessage(peerInteraction->createHaveMessage(*itr)); - } + peerInteraction->addMessage(peerInteraction->createBitfieldMessage()); + } + } else { + for(PieceIndexes::iterator itr = indexes.begin(); itr != indexes.end(); itr++) { + peerInteraction->addMessage(peerInteraction->createHaveMessage(*itr)); } - keepAlive(); } } diff --git a/src/PeerInteractionCommand.h b/src/PeerInteractionCommand.h index 61fa074f..95356fa1 100644 --- a/src/PeerInteractionCommand.h +++ b/src/PeerInteractionCommand.h @@ -46,13 +46,13 @@ private: void checkLongTimePeerChoking(); void detectTimeoutAndDuplicateBlock(); void decideChoking(); - void keepAlive(); + void sendKeepAlive(); + void checkHave(); protected: bool executeInternal(); bool prepareForRetry(int wait); bool prepareForNextPeer(int wait); void onAbort(Exception* ex); - void beforeSocketCheck(); public: PeerInteractionCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, const Socket* s, int sequence); ~PeerInteractionCommand(); diff --git a/src/PeerMessageUtil.h b/src/PeerMessageUtil.h index 604ba24c..dac3e7d8 100644 --- a/src/PeerMessageUtil.h +++ b/src/PeerMessageUtil.h @@ -37,6 +37,7 @@ #include "HaveAllMessage.h" #include "HaveNoneMessage.h" #include "PeerConnection.h" +#include "common.h" #define MAX_BLOCK_LENGTH (128*1024) diff --git a/src/Piece.h b/src/Piece.h index 7cf322ce..2b7df119 100644 --- a/src/Piece.h +++ b/src/Piece.h @@ -56,7 +56,10 @@ public: bool hasBlock(int blockIndex) const { return bitfield->isBitSet(blockIndex); } - + /** + * Returns true if all blocks of this piece have been downloaded, otherwise + * returns false. + */ bool pieceComplete() const; int countBlock() const { return bitfield->countBlock(); } int getBlockLength(int index) const { diff --git a/src/TorrentMan.cc b/src/TorrentMan.cc index 4b3803e7..2a86ece9 100644 --- a/src/TorrentMan.cc +++ b/src/TorrentMan.cc @@ -74,7 +74,9 @@ void TorrentMan::updatePeers(const Peers& peers) { } bool TorrentMan::addPeer(Peer* peer, bool duplicate) { - deleteOldErrorPeers(MAX_PEER_LIST_SIZE); + if(peers.size() >= MAX_PEER_LIST_SIZE) { + deleteOldErrorPeers(); + } if(duplicate) { for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) { Peer* p = *itr; @@ -83,6 +85,9 @@ bool TorrentMan::addPeer(Peer* peer, bool duplicate) { } } } else { + if(peers.size() >= MAX_PEER_LIST_SIZE) { + return false; + } for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) { Peer* p = *itr; if(p->ipaddr == peer->ipaddr && p->port == peer->port) { @@ -112,22 +117,16 @@ bool TorrentMan::isPeerAvailable() const { return getPeer() != Peer::nullPeer; } -int TorrentMan::deleteOldErrorPeers(int maxNum) { - int counter = 0; +void TorrentMan::deleteOldErrorPeers() { for(Peers::iterator itr = peers.begin(); itr != peers.end();) { Peer* p = *itr; if(p->error >= MAX_PEER_ERROR && p->cuid == 0) { delete p; itr = peers.erase(itr); - counter++; - if(maxNum <= counter) { - break; - } } else { itr++; } } - return counter; } Peer* TorrentMan::getPeer() const { @@ -213,7 +212,7 @@ Piece TorrentMan::checkOutPiece(int index) { int TorrentMan::deleteUsedPiecesByFillRate(int fillRate, int toDelete) { int deleted = 0; - for(UsedPieces::iterator itr = usedPieces.begin(); + for(Pieces::iterator itr = usedPieces.begin(); itr != usedPieces.end() && deleted < toDelete;) { Piece& piece = *itr; if(!bitfield->isUseBitSet(piece.getIndex()) && @@ -248,11 +247,12 @@ void TorrentMan::reduceUsedPieces(int max) { } void TorrentMan::addUsedPiece(const Piece& piece) { + // TODO ? if nullPiece usedPieces.push_back(piece); } Piece TorrentMan::findUsedPiece(int index) const { - for(UsedPieces::const_iterator itr = usedPieces.begin(); itr != usedPieces.end(); itr++) { + for(Pieces::const_iterator itr = usedPieces.begin(); itr != usedPieces.end(); itr++) { const Piece& piece = *itr; if(piece.getIndex() == index) { return piece; @@ -265,7 +265,10 @@ void TorrentMan::deleteUsedPiece(const Piece& piece) { if(Piece::isNull(piece)) { return; } - usedPieces.erase(std::remove(usedPieces.begin(), usedPieces.end(), piece)); + Pieces::iterator itr = find(usedPieces.begin(), usedPieces.end(), piece); + if(itr != usedPieces.end()) { + usedPieces.erase(itr); + } } void TorrentMan::completePiece(const Piece& piece) { @@ -300,8 +303,8 @@ void TorrentMan::updatePiece(const Piece& piece) { if(Piece::isNull(piece)) { return; } - UsedPieces::iterator itr = find(usedPieces.begin(), usedPieces.end(), - piece); + Pieces::iterator itr = find(usedPieces.begin(), usedPieces.end(), + piece); if(itr != usedPieces.end()) { *itr = piece; } @@ -311,8 +314,8 @@ void TorrentMan::syncPiece(Piece& piece) { if(Piece::isNull(piece)) { return; } - UsedPieces::iterator itr = find(usedPieces.begin(), usedPieces.end(), - piece); + Pieces::iterator itr = find(usedPieces.begin(), usedPieces.end(), + piece); if(itr != usedPieces.end()) { piece = *itr; return; diff --git a/src/TorrentMan.h b/src/TorrentMan.h index 74680f19..77ecea9e 100644 --- a/src/TorrentMan.h +++ b/src/TorrentMan.h @@ -52,8 +52,8 @@ using namespace std; typedef deque Peers; typedef multimap Haves; -typedef deque UsedPieces; typedef deque PieceIndexes; +typedef deque Pieces; class TorrentMan { private: @@ -74,7 +74,7 @@ private: string storeDir; int port; Haves haves; - UsedPieces usedPieces; + Pieces usedPieces; bool setupComplete; const Logger* logger; Peers activePeers; @@ -126,7 +126,7 @@ public: const Peers& getPeers() const { return peers; } Peer* getPeer() const; bool isPeerAvailable() const; - int deleteOldErrorPeers(int maxNum); + void deleteOldErrorPeers(); bool hasMissingPiece(const Peer* peer) const; int getMissingPieceIndex(const Peer* peer) const;