ソースを参照

2006-05-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	* src/PeerAbstractCommand.h
	(beforeSocketCheck): Removed.
	* src/PeerAbstractCommand.cc
	Modified in order to call executeInternal() even if socket check
	and upload limit check fail.
	* src/PeerInteractionCommand.h
	(keepAlive): Removed.
	(sendKeepAlive): New function.
	(checkHave): New function.
	(beforeSocketCheck): Removed.
	* src/PeerInteractionCommand.cc
	(executeInternal): Use peerInteraction->checkRequestSlot(). 
Added
	calls to checkHave() and sendKeepAlive().
	(keepAlive): Renamed to sendKeepAlive().
	(sendKeepAlive): New function.
	(beforeSocketCheck): Removed.
	(checkHave): New function.
	* src/BitfieldMan.cc
	(getMissingIndex): Don't call getMissingIndexRandomly() if max 
is 0.
	(getMissingUnusedIndex): Don't call getMissingIndexRandomly() if 
max is
	0.
	(getMissingIndex): Dont't call getMissingIndexRandomly() if max 
is 0.
	* src/TorrentMan.h
	(UsedPieces): Removed.
	(Pieces): New type definition.
	* src/Piece.h: Updated doc.
	* src/Peer.h
	(totalLength): Removed.
	* src/Peer.cc
	(updateLatency): Fixed the latency calculation.
	* src/TorrentMan.cc
	(addPeer): Call deleteOldErrorPeers() only if peers.size() is 
higher
	than or equal to MAX_PEER_LIST_SIZE.
	If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
	then return false.
	(deleteOldErrorPeers): Rewritten.
	(deleteUsedPiece): Fixed the miss use of STL remove.
	* src/PeerInteraction.h
	(Pieces): Removed.
	(deleteTimeoutRequestSlot): Removed.
	(deleteCompletedRequestSlot): Removed.
	(checkRequestSlot): New function.
	* src/PeerInteraction.cc
	(deleteTimeoutRequestSlot): Merged to checkRequestSlot().
	(deleteCompletedRequestSlot): Merged to checkRequestSlot().
	(checkRequestSlot): New function.
	* src/DownloadEngine.cc
	(run): Clear activeSockets before calling waitData().
	(waitData): Removed a call to activeSockets.clear().
Tatsuhiro Tsujikawa 19 年 前
コミット
ca5e332df9

+ 52 - 0
ChangeLog

@@ -1,3 +1,55 @@
+2006-05-26  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	* src/PeerAbstractCommand.h
+	(beforeSocketCheck): Removed.
+	* src/PeerAbstractCommand.cc
+	Modified in order to call executeInternal() even if socket check
+	and upload limit check fail.
+	* src/PeerInteractionCommand.h
+	(keepAlive): Removed.
+	(sendKeepAlive): New function.
+	(checkHave): New function.
+	(beforeSocketCheck): Removed.
+	* src/PeerInteractionCommand.cc
+	(executeInternal): Use peerInteraction->checkRequestSlot(). Added
+	calls to checkHave() and sendKeepAlive().
+	(keepAlive): Renamed to sendKeepAlive().
+	(sendKeepAlive): New function.
+	(beforeSocketCheck): Removed.
+	(checkHave): New function.
+	* src/BitfieldMan.cc
+	(getMissingIndex): Don't call getMissingIndexRandomly() if max is 0.
+	(getMissingUnusedIndex): Don't call getMissingIndexRandomly() if max is
+	0.
+	(getMissingIndex): Dont't call getMissingIndexRandomly() if max is 0.
+	* src/TorrentMan.h
+	(UsedPieces): Removed.
+	(Pieces): New type definition.
+	* src/Piece.h: Updated doc.
+	* src/Peer.h
+	(totalLength): Removed.
+	* src/Peer.cc
+	(updateLatency): Fixed the latency calculation.
+	* src/TorrentMan.cc
+	(addPeer): Call deleteOldErrorPeers() only if peers.size() is higher
+	than or equal to MAX_PEER_LIST_SIZE.
+	If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
+	then return false.
+	(deleteOldErrorPeers): Rewritten.
+	(deleteUsedPiece): Fixed the miss use of STL remove.
+	* src/PeerInteraction.h
+	(Pieces): Removed.
+	(deleteTimeoutRequestSlot): Removed.
+	(deleteCompletedRequestSlot): Removed.
+	(checkRequestSlot): New function.
+	* src/PeerInteraction.cc
+	(deleteTimeoutRequestSlot): Merged to checkRequestSlot().
+	(deleteCompletedRequestSlot): Merged to checkRequestSlot().
+	(checkRequestSlot): New function.
+	* src/DownloadEngine.cc
+	(run): Clear activeSockets before calling waitData().
+	(waitData): Removed a call to activeSockets.clear().
+	
 2006-05-24  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	To attempt to handle EINTR:

+ 1 - 1
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

+ 0 - 3
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)

+ 10 - 11
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 <tujikawa@rednoah.com>.
 #
@@ -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'`\\"
 

+ 1 - 2
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])
 

+ 1 - 1
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
 

+ 71 - 71
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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""

BIN
po/de.gmo


+ 71 - 71
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 <hj.beckers@onlinehome.de>\n"
 "Language-Team: deutsch <de@li.org>\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"

BIN
po/ja.gmo


+ 83 - 84
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 <tujikawa@rednoah.com>\n"
 "Language-Team: Japanese <ja@li.org>\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"

+ 12 - 3
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;
 }

+ 1 - 2
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;

+ 1 - 1
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;
 }

+ 1 - 2
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);

+ 8 - 13
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);

+ 0 - 1
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);

+ 1 - 0
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.

+ 15 - 23
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;

+ 1 - 3
src/PeerInteraction.h

@@ -48,7 +48,6 @@
 
 typedef deque<RequestSlot> RequestSlots;
 typedef deque<PeerMessage*> MessageQueue;
-typedef deque<Piece> 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;
 

+ 16 - 21
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();
   }
 }

+ 2 - 2
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();

+ 1 - 0
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)
 

+ 4 - 1
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 {

+ 18 - 15
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;

+ 3 - 3
src/TorrentMan.h

@@ -52,8 +52,8 @@ using namespace std;
 
 typedef deque<Peer*> Peers;
 typedef multimap<int, int> Haves;
-typedef deque<Piece> UsedPieces;
 typedef deque<int> PieceIndexes;
+typedef deque<Piece> 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;