소스 검색

2006-10-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Request -> RequestHandle:
	
	* src/HttpResponseCommand.h: Request->RequestHandle
	* src/AbstractCommand.cc: Request->RequestHandle
	* src/HttpDownloadCommand.cc: Request->RequestHandle
	* src/HttpRequestCommand.cc: Request->RequestHandle
	* src/FtpInitiateConnectionCommand.h: Request->RequestHandle
	* src/AbstractCommand.h: Request->RequestHandle
	* src/HttpProxyRequestCommand.h: Request->RequestHandle
	* src/HttpResponseCommand.cc: Request->RequestHandle
	* src/HttpInitiateConnectionCommand.h: Request->RequestHandle
	* src/FtpNegotiateCommand.cc: Request->RequestHandle
	* src/FtpTunnelResponseCommand.h: Request->RequestHandle
	* src/HttpConnection.h: Request->RequestHandle
	* src/HttpProxyResponseCommand.cc: Request->RequestHandle
	* src/InitiateConnectionCommandFactory.h: Request->RequestHandle
	* src/FtpTunnelResponseCommand.cc: Request->RequestHandle
	* src/DownloadCommand.h: Request->RequestHandle
	* src/FtpDowndloadCommand.cc: Request->RequestHandle
	* src/HttpInitiateConnectionCommand.cc: Request->RequestHandle
	* src/HttpRequestCommand.h: Request->RequestHandle
	* src/FtpNegotiateCommand.h: Request->RequestHandle
	* src/FtpTunnelResponseCommand.cc: Request->RequestHandle
	* src/FtpInitiateConnectionCommand.cc: Request->RequestHandle
	* src/HttpDownloadCommand.h: Request->RequestHandle
	* src/FtpConnection.cc: Request->RequestHandle
	* src/InitiateConnectionCommandFactory.cc: 
Request->RequestHandle
	* src/UrlRequestInfo.cc: Request->RequestHandle
	* src/HttpProxyResponseCommand.h: Request->RequestHandle
	* src/HttpConnection.h: Request->RequestHandle
	* src/DownloadCommand.cc: Request->RequestHandle
	* src/FtpConnection.h: Request->RequestHandle
	* src/FtpDowndloadCommand.h: Request->RequestHandle
	* src/HttpProxyRequestCommand.cc: Request->RequestHandle
	* src/FtpTunnelRequestCommand.h: Request->RequestHandle
	* src/Request.h
	(SharedHandle.h): New include.
	(RequestHandle): New type definition.
	(Requests): Redefined.
	
	To add MULTITRACKER support:

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

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

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

	* src/Util.cc
	(urldecode): Removed "+"->space decoding rule. Test case was 
updated.
Tatsuhiro Tsujikawa 19 년 전
부모
커밋
c0fd1fff2a
69개의 변경된 파일1809개의 추가작업 그리고 497개의 파일을 삭제
  1. 83 0
      ChangeLog
  2. 16 10
      Makefile.in
  3. 4 1
      TODO
  4. 13 0
      aclocal.m4
  5. 3 3
      config.h.in
  6. 630 153
      configure
  7. 16 10
      doc/Makefile.in
  8. 16 10
      m4/Makefile.in
  9. 35 31
      po/aria2c.pot
  10. BIN
      po/de.gmo
  11. 35 32
      po/de.po
  12. BIN
      po/ja.gmo
  13. 55 41
      po/ja.po
  14. BIN
      po/ru.gmo
  15. 35 32
      po/ru.po
  16. 4 2
      src/AbstractCommand.cc
  17. 2 2
      src/AbstractCommand.h
  18. 225 0
      src/AnnounceList.cc
  19. 158 0
      src/AnnounceList.h
  20. 3 1
      src/DownloadCommand.cc
  21. 1 1
      src/DownloadCommand.h
  22. 0 4
      src/DownloadEngineFactory.cc
  23. 1 1
      src/FtpConnection.cc
  24. 2 2
      src/FtpConnection.h
  25. 2 1
      src/FtpDownloadCommand.cc
  26. 1 1
      src/FtpDownloadCommand.h
  27. 1 1
      src/FtpInitiateConnectionCommand.cc
  28. 1 1
      src/FtpInitiateConnectionCommand.h
  29. 1 1
      src/FtpNegotiationCommand.cc
  30. 1 1
      src/FtpNegotiationCommand.h
  31. 2 1
      src/FtpTunnelRequestCommand.cc
  32. 1 1
      src/FtpTunnelRequestCommand.h
  33. 2 1
      src/FtpTunnelResponseCommand.cc
  34. 1 1
      src/FtpTunnelResponseCommand.h
  35. 1 1
      src/HttpConnection.cc
  36. 2 2
      src/HttpConnection.h
  37. 1 1
      src/HttpDownloadCommand.cc
  38. 1 1
      src/HttpDownloadCommand.h
  39. 1 1
      src/HttpInitiateConnectionCommand.cc
  40. 1 1
      src/HttpInitiateConnectionCommand.h
  41. 2 1
      src/HttpProxyRequestCommand.cc
  42. 1 1
      src/HttpProxyRequestCommand.h
  43. 2 1
      src/HttpProxyResponseCommand.cc
  44. 1 1
      src/HttpProxyResponseCommand.h
  45. 2 1
      src/HttpRequestCommand.cc
  46. 1 1
      src/HttpRequestCommand.h
  47. 2 1
      src/HttpResponseCommand.cc
  48. 1 1
      src/HttpResponseCommand.h
  49. 1 1
      src/InitiateConnectionCommandFactory.cc
  50. 2 1
      src/InitiateConnectionCommandFactory.h
  51. 2 1
      src/Makefile.am
  52. 24 15
      src/Makefile.in
  53. 3 1
      src/Request.h
  54. 10 3
      src/TorrentMan.cc
  55. 3 2
      src/TorrentMan.h
  56. 2 0
      src/TorrentRequestInfo.cc
  57. 5 9
      src/TrackerUpdateCommand.cc
  58. 81 66
      src/TrackerWatcherCommand.cc
  59. 2 0
      src/TrackerWatcherCommand.h
  60. 1 5
      src/UrlRequestInfo.cc
  61. 1 3
      src/Util.cc
  62. 1 0
      src/main.cc
  63. 3 1
      src/prefs.h
  64. 273 0
      test/AnnounceListTest.cc
  65. 2 2
      test/DefaultPeerListProcessorTest.cc
  66. 2 1
      test/Makefile.am
  67. 21 12
      test/Makefile.in
  68. 0 12
      test/SegmentManTest.cc
  69. 1 1
      test/UtilTest.cc

+ 83 - 0
ChangeLog

@@ -1,3 +1,86 @@
+2006-10-18  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Request -> RequestHandle:
+	
+	* src/HttpResponseCommand.h: Request->RequestHandle
+	* src/AbstractCommand.cc: Request->RequestHandle
+	* src/HttpDownloadCommand.cc: Request->RequestHandle
+	* src/HttpRequestCommand.cc: Request->RequestHandle
+	* src/FtpInitiateConnectionCommand.h: Request->RequestHandle
+	* src/AbstractCommand.h: Request->RequestHandle
+	* src/HttpProxyRequestCommand.h: Request->RequestHandle
+	* src/HttpResponseCommand.cc: Request->RequestHandle
+	* src/HttpInitiateConnectionCommand.h: Request->RequestHandle
+	* src/FtpNegotiateCommand.cc: Request->RequestHandle
+	* src/FtpTunnelResponseCommand.h: Request->RequestHandle
+	* src/HttpConnection.h: Request->RequestHandle
+	* src/HttpProxyResponseCommand.cc: Request->RequestHandle
+	* src/InitiateConnectionCommandFactory.h: Request->RequestHandle
+	* src/FtpTunnelResponseCommand.cc: Request->RequestHandle
+	* src/DownloadCommand.h: Request->RequestHandle
+	* src/FtpDowndloadCommand.cc: Request->RequestHandle
+	* src/HttpInitiateConnectionCommand.cc: Request->RequestHandle
+	* src/HttpRequestCommand.h: Request->RequestHandle
+	* src/FtpNegotiateCommand.h: Request->RequestHandle
+	* src/FtpTunnelResponseCommand.cc: Request->RequestHandle
+	* src/FtpInitiateConnectionCommand.cc: Request->RequestHandle
+	* src/HttpDownloadCommand.h: Request->RequestHandle
+	* src/FtpConnection.cc: Request->RequestHandle
+	* src/InitiateConnectionCommandFactory.cc: Request->RequestHandle
+	* src/UrlRequestInfo.cc: Request->RequestHandle
+	* src/HttpProxyResponseCommand.h: Request->RequestHandle
+	* src/HttpConnection.h: Request->RequestHandle
+	* src/DownloadCommand.cc: Request->RequestHandle
+	* src/FtpConnection.h: Request->RequestHandle
+	* src/FtpDowndloadCommand.h: Request->RequestHandle
+	* src/HttpProxyRequestCommand.cc: Request->RequestHandle
+	* src/FtpTunnelRequestCommand.h: Request->RequestHandle
+	* src/Request.h
+	(SharedHandle.h): New include.
+	(RequestHandle): New type definition.
+	(Requests): Redefined.
+	
+	To add MULTITRACKER support:
+
+	* src/TrackerWatcherCommand.h
+	(createRequestCommand): New function.
+	* src/DownloadEngineFactory.cc
+	(newTorrentConsoleEngine): Removed req.
+	* src/prefs.h
+	(PREF_TRACKER_MAX_TRIES): New definition.
+	* src/TorrentMan.cc
+	(TorrentMan): Removed req. Added trackerNumTry.
+	(~TorrentMan): Removed req.
+	(setupInternal1): Added announceList.
+	* src/TorrentRequestInfo.cc
+	(execute): Set PREF_MAX_TIRES to 1. The max number of tries for
+	announces is now specified by PREF_TRACKER_MAX_TRIES.
+	* src/main.cc
+	(main): Added PREF_TRACKER_MAX_TRIES.
+	* src/TorrentMan.h
+	(Request.h): Removed.
+	(AnnounceList.h): New include.
+	(trackerNumTry): New variable.
+	(req): Removed.
+	(announceList): New variable.
+	* src/TrackerWatcherCommand.cc
+	(execute): Rewritten.
+	(createRequestCommand): New function.
+	* src/TrackerUpdateCommand.cc
+	(execute): Updated with the use of AnnounceList.
+	* src/AnnounceList.cc: New class.
+	* src/AnnounceList.h: New class.
+	
+	To fix typo:
+
+	* src/prefs.h
+	(PREF_MAX_TRIES): max_try->max_tries
+
+	To not to decode "+" as space in URL decode:
+
+	* src/Util.cc
+	(urldecode): Removed "+"->space decoding rule. Test case was updated.
+	
 2006-10-01  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	To add timeout to async name resolution:

+ 16 - 10
Makefile.in

@@ -47,14 +47,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
 	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
 	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
 	$(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
-	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
-	$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/nls.m4 \
-	$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
-	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
-	$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isc-posix.m4 \
+	$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libares.m4 $(top_srcdir)/m4/libcares.m4 \
+	$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
+	$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -124,6 +124,7 @@ EXEEXT = @EXEEXT@
 GENCAT = @GENCAT@
 GLIBC21 = @GLIBC21@
 GMSGFMT = @GMSGFMT@
+GREP = @GREP@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -178,10 +179,9 @@ XML2_CONFIG = @XML2_CONFIG@
 XML_CPPFLAGS = @XML_CPPFLAGS@
 XML_LIBS = @XML_LIBS@
 YACC = @YACC@
+YFLAGS = @YFLAGS@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -198,12 +198,16 @@ build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
@@ -214,8 +218,10 @@ localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@

+ 4 - 1
TODO

@@ -5,7 +5,6 @@
 * Better HTTP status handling
 * Download files listed in a specifed file.
 * Add the feature which adds or removes URLs on-the-fly.
-* no-compact peers format
 * Add port range command-line option
 * Add max peers command-line option
 * Refacturing HttpConnection and FtpConnection
@@ -17,3 +16,7 @@
 * Add multi-file metalink support.
 * Add a control port for GUI frontend
 * Add a version header to .aria2 file to check the compatibiliy.
+* Use SharedHandle where it is useful.
+* Add support for "announce-list".
+* Rewrite Util::countBit
+* Add the ability to display filename or URL to be downloaded in metalink mode. 

+ 13 - 0
aclocal.m4

@@ -41,6 +41,7 @@ AC_ARG_WITH(cppunit-exec-prefix,[  --with-cppunit-exec-prefix=PFX  Exec prefix w
   AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
   no_cppunit=""
   if test "$CPPUNIT_CONFIG" = "no" ; then
+    AC_MSG_RESULT(no)
     no_cppunit=yes
   else
     CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
@@ -56,10 +57,21 @@ AC_ARG_WITH(cppunit-exec-prefix,[  --with-cppunit-exec-prefix=PFX  Exec prefix w
 
     cppunit_major_min=`echo $cppunit_version_min | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    if test "x${cppunit_major_min}" = "x" ; then
+       cppunit_major_min=0
+    fi
+    
     cppunit_minor_min=`echo $cppunit_version_min | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    if test "x${cppunit_minor_min}" = "x" ; then
+       cppunit_minor_min=0
+    fi
+    
     cppunit_micro_min=`echo $cppunit_version_min | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x${cppunit_micro_min}" = "x" ; then
+       cppunit_micro_min=0
+    fi
 
     cppunit_version_proper=`expr \
         $cppunit_major_version \> $cppunit_major_min \| \
@@ -1396,6 +1408,7 @@ m4_include([m4/intdiv0.m4])
 m4_include([m4/inttypes-pri.m4])
 m4_include([m4/inttypes.m4])
 m4_include([m4/inttypes_h.m4])
+m4_include([m4/isc-posix.m4])
 m4_include([m4/lcmessage.m4])
 m4_include([m4/lib-ld.m4])
 m4_include([m4/lib-link.m4])

+ 3 - 3
config.h.in

@@ -343,7 +343,7 @@
 
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
-   automatically deduced at run-time.
+   automatically deduced at runtime.
 	STACK_DIRECTION > 0 => grows toward higher addresses
 	STACK_DIRECTION < 0 => grows toward lower addresses
 	STACK_DIRECTION = 0 => direction of growth unknown */
@@ -373,13 +373,13 @@
 /* Define to rpl_malloc if the replacement function should be used. */
 #undef malloc
 
-/* Define to `long' if <sys/types.h> does not define. */
+/* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
 
 /* Define to rpl_realloc if the replacement function should be used. */
 #undef realloc
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
 /* Define to unsigned long or unsigned long long if <stdint.h> and

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 630 - 153
configure


+ 16 - 10
doc/Makefile.in

@@ -42,14 +42,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
 	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
 	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
 	$(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
-	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
-	$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/nls.m4 \
-	$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
-	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
-	$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isc-posix.m4 \
+	$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libares.m4 $(top_srcdir)/m4/libcares.m4 \
+	$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
+	$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,6 +102,7 @@ EXEEXT = @EXEEXT@
 GENCAT = @GENCAT@
 GLIBC21 = @GLIBC21@
 GMSGFMT = @GMSGFMT@
+GREP = @GREP@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -156,10 +157,9 @@ XML2_CONFIG = @XML2_CONFIG@
 XML_CPPFLAGS = @XML_CPPFLAGS@
 XML_LIBS = @XML_LIBS@
 YACC = @YACC@
+YFLAGS = @YFLAGS@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -176,12 +176,16 @@ build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
@@ -192,8 +196,10 @@ localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@

+ 16 - 10
m4/Makefile.in

@@ -42,14 +42,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
 	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
 	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
 	$(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
-	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
-	$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/nls.m4 \
-	$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
-	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
-	$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isc-posix.m4 \
+	$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libares.m4 $(top_srcdir)/m4/libcares.m4 \
+	$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
+	$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -98,6 +98,7 @@ EXEEXT = @EXEEXT@
 GENCAT = @GENCAT@
 GLIBC21 = @GLIBC21@
 GMSGFMT = @GMSGFMT@
+GREP = @GREP@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -152,10 +153,9 @@ XML2_CONFIG = @XML2_CONFIG@
 XML_CPPFLAGS = @XML_CPPFLAGS@
 XML_LIBS = @XML_LIBS@
 YACC = @YACC@
+YFLAGS = @YFLAGS@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -172,12 +172,16 @@ build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
@@ -188,8 +192,10 @@ localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@

+ 35 - 31
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-10-01 22:14+0900\n"
+"POT-Creation-Date: 2006-10-18 23:54+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"
@@ -16,11 +16,11 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/TorrentMan.cc:678
+#: src/TorrentMan.cc:685
 msgid "Download of selected files was complete."
 msgstr ""
 
-#: src/TorrentMan.cc:681
+#: src/TorrentMan.cc:688
 msgid "The download was complete."
 msgstr ""
 
@@ -32,6 +32,7 @@ msgid ""
 msgstr ""
 
 #: src/RequestInfo.h:105
+#, c-format
 msgid ""
 "\n"
 "The download was not complete because of errors. Check the log.\n"
@@ -351,21 +352,24 @@ msgstr ""
 msgid "Failed to peek data, cause: %s"
 msgstr ""
 
-#: src/DownloadEngineFactory.cc:114
+#: src/DownloadEngineFactory.cc:110
+#, c-format
 msgid "Errors occurred while binding port.\n"
 msgstr ""
 
-#: src/TorrentRequestInfo.cc:88
+#: src/TorrentRequestInfo.cc:90
 msgid "Files:"
 msgstr ""
 
 #: src/UrlRequestInfo.cc:76
+#, c-format
 msgid ""
 "\n"
 "stopping application...\n"
 msgstr ""
 
 #: src/UrlRequestInfo.cc:81
+#, c-format
 msgid "done\n"
 msgstr ""
 
@@ -740,109 +744,109 @@ msgstr ""
 msgid "Report bugs to %s"
 msgstr ""
 
-#: src/main.cc:401
+#: src/main.cc:403
 msgid "unrecognized proxy format"
 msgstr ""
 
-#: src/main.cc:428
+#: src/main.cc:430
 msgid "Currently, supported authentication scheme is basic."
 msgstr ""
 
-#: src/main.cc:437
+#: src/main.cc:439
 msgid "retry-wait must be between 0 and 60."
 msgstr ""
 
-#: src/main.cc:454
+#: src/main.cc:456
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgstr ""
 
-#: src/main.cc:463
+#: src/main.cc:465
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgstr ""
 
-#: src/main.cc:471
+#: src/main.cc:473
 msgid "min-segment-size invalid"
 msgstr ""
 
-#: src/main.cc:482
+#: src/main.cc:484
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgstr ""
 
-#: src/main.cc:490
+#: src/main.cc:492
 msgid "listen-port must be between 1024 and 65535."
 msgstr ""
 
-#: src/main.cc:503
+#: src/main.cc:505
 msgid "follow-torrent must be either 'true' or 'false'."
 msgstr ""
 
-#: src/main.cc:517
+#: src/main.cc:519
 msgid "direct-file-mapping must be either 'true' or 'false'."
 msgstr ""
 
-#: src/main.cc:528
+#: src/main.cc:530
 msgid "upload-limit must be greater than or equal to 0."
 msgstr ""
 
-#: src/main.cc:541
+#: src/main.cc:543
 msgid "seed-time must be greater than or equal to 0."
 msgstr ""
 
-#: src/main.cc:551
+#: src/main.cc:553
 msgid "seed-ratio must be greater than or equal to 0.0."
 msgstr ""
 
-#: src/main.cc:561
+#: src/main.cc:563
 msgid "max-upload-limit must be greater than or equal to 0"
 msgstr ""
 
-#: src/main.cc:583
+#: src/main.cc:585
 msgid "follow-metalink must be either 'true' or 'false'."
 msgstr ""
 
-#: src/main.cc:591
+#: src/main.cc:593
 msgid "lowest-speed-limit must be greater than or equal to 0"
 msgstr ""
 
-#: src/main.cc:601
+#: src/main.cc:603
 msgid "max-download-limit must be greater than or equal to 0"
 msgstr ""
 
-#: src/main.cc:630
+#: src/main.cc:632
 msgid "split must be between 1 and 5."
 msgstr ""
 
-#: src/main.cc:643
+#: src/main.cc:645
 msgid "timeout must be between 1 and 600"
 msgstr ""
 
-#: src/main.cc:652
+#: src/main.cc:654
 msgid "max-tries invalid"
 msgstr ""
 
-#: src/main.cc:674
+#: src/main.cc:676
 msgid "metalink-servers must be greater than 0."
 msgstr ""
 
-#: src/main.cc:694
+#: src/main.cc:696
 msgid "specify at least one URL"
 msgstr ""
 
-#: src/main.cc:701
+#: src/main.cc:703
 msgid "daemon failed"
 msgstr ""
 
-#: src/main.cc:764
+#: src/main.cc:766
 msgid ""
 "Now verifying checksum.\n"
 "This may take some time depending on your PC environment and the size of "
 "file."
 msgstr ""
 
-#: src/main.cc:768
+#: src/main.cc:770
 msgid "checksum OK."
 msgstr ""
 
-#: src/main.cc:771
+#: src/main.cc:773
 msgid "checksum ERROR."
 msgstr ""

BIN
po/de.gmo


+ 35 - 32
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-10-01 22:14+0900\n"
+"POT-Creation-Date: 2006-10-18 23:54+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"
@@ -16,12 +16,12 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: KBabel 1.3\n"
 
-#: src/TorrentMan.cc:678
+#: src/TorrentMan.cc:685
 #, fuzzy
 msgid "Download of selected files was complete."
 msgstr " Nur ausgewählte Dateien abrufen:"
 
-#: src/TorrentMan.cc:681
+#: src/TorrentMan.cc:688
 #, fuzzy
 msgid "The download was complete."
 msgstr ""
@@ -38,7 +38,7 @@ msgstr ""
 "Abruf ist vollständig. <%s>\n"
 
 #: src/RequestInfo.h:105
-#, fuzzy
+#, fuzzy, c-format
 msgid ""
 "\n"
 "The download was not complete because of errors. Check the log.\n"
@@ -369,15 +369,17 @@ msgstr "Konnte Daten nicht erhalten, Ursache: %s"
 msgid "Failed to peek data, cause: %s"
 msgstr "Datenermittelung fehlgeschlagen, Ursache: %s"
 
-#: src/DownloadEngineFactory.cc:114
+#: src/DownloadEngineFactory.cc:110
+#, c-format
 msgid "Errors occurred while binding port.\n"
 msgstr "Fehler beim Binden an Port aufgetreten.\n"
 
-#: src/TorrentRequestInfo.cc:88
+#: src/TorrentRequestInfo.cc:90
 msgid "Files:"
 msgstr "Dateien:"
 
 #: src/UrlRequestInfo.cc:76
+#, c-format
 msgid ""
 "\n"
 "stopping application...\n"
@@ -386,6 +388,7 @@ msgstr ""
 "Anwendung wird gestoppt ...\n"
 
 #: src/UrlRequestInfo.cc:81
+#, c-format
 msgid "done\n"
 msgstr "erledigt\n"
 
@@ -897,117 +900,117 @@ msgstr ""
 msgid "Report bugs to %s"
 msgstr "Fehler an %s melden"
 
-#: src/main.cc:401
+#: src/main.cc:403
 msgid "unrecognized proxy format"
 msgstr "nicht erkanntes Proxy-Format"
 
-#: src/main.cc:428
+#: src/main.cc:430
 msgid "Currently, supported authentication scheme is basic."
 msgstr "Derzeit unterstütztes Authentifizierungsschema ist basic."
 
-#: src/main.cc:437
+#: src/main.cc:439
 msgid "retry-wait must be between 0 and 60."
 msgstr "retry-wait muss zwischen 0 und 60 liegen."
 
-#: src/main.cc:454
+#: src/main.cc:456
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgstr "ftp-type muss entweder 'binary' oder 'ascii' sein."
 
-#: src/main.cc:463
+#: src/main.cc:465
 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:471
+#: src/main.cc:473
 msgid "min-segment-size invalid"
 msgstr "min-segment-size ungültig"
 
-#: src/main.cc:482
+#: src/main.cc:484
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgstr "http-proxy-method muss entweder 'get' oder 'tunnel' sein."
 
-#: src/main.cc:490
+#: src/main.cc:492
 msgid "listen-port must be between 1024 and 65535."
 msgstr "listen-port muss zwischen 1024 und 65535 liegen."
 
-#: src/main.cc:503
+#: src/main.cc:505
 msgid "follow-torrent must be either 'true' or 'false'."
 msgstr "follow-torrent muss entweder 'true' oder 'false' sein."
 
-#: src/main.cc:517
+#: src/main.cc:519
 msgid "direct-file-mapping must be either 'true' or 'false'."
 msgstr "direct-file-mapping muss entweder 'true' oder 'false' sein."
 
-#: src/main.cc:528
+#: src/main.cc:530
 msgid "upload-limit must be greater than or equal to 0."
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:541
+#: src/main.cc:543
 #, fuzzy
 msgid "seed-time must be greater than or equal to 0."
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:551
+#: src/main.cc:553
 #, fuzzy
 msgid "seed-ratio must be greater than or equal to 0.0."
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:561
+#: src/main.cc:563
 #, fuzzy
 msgid "max-upload-limit must be greater than or equal to 0"
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:583
+#: src/main.cc:585
 #, fuzzy
 msgid "follow-metalink must be either 'true' or 'false'."
 msgstr "follow-torrent muss entweder 'true' oder 'false' sein."
 
-#: src/main.cc:591
+#: src/main.cc:593
 #, fuzzy
 msgid "lowest-speed-limit must be greater than or equal to 0"
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:601
+#: src/main.cc:603
 #, fuzzy
 msgid "max-download-limit must be greater than or equal to 0"
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:630
+#: src/main.cc:632
 msgid "split must be between 1 and 5."
 msgstr "split muss zwischen 1 und 5 liegen."
 
-#: src/main.cc:643
+#: src/main.cc:645
 msgid "timeout must be between 1 and 600"
 msgstr "timeout muss zwischen 1 und 600 liegen."
 
-#: src/main.cc:652
+#: src/main.cc:654
 msgid "max-tries invalid"
 msgstr "max-tries ungültig"
 
-#: src/main.cc:674
+#: src/main.cc:676
 #, fuzzy
 msgid "metalink-servers must be greater than 0."
 msgstr "upload-limit muss größer oder gleich 0 sein."
 
-#: src/main.cc:694
+#: src/main.cc:696
 msgid "specify at least one URL"
 msgstr "Geben Sie zumindest eine URL an"
 
-#: src/main.cc:701
+#: src/main.cc:703
 msgid "daemon failed"
 msgstr "Daemon-Start nicht erfolgreich"
 
-#: src/main.cc:764
+#: src/main.cc:766
 msgid ""
 "Now verifying checksum.\n"
 "This may take some time depending on your PC environment and the size of "
 "file."
 msgstr ""
 
-#: src/main.cc:768
+#: src/main.cc:770
 msgid "checksum OK."
 msgstr ""
 
-#: src/main.cc:771
+#: src/main.cc:773
 msgid "checksum ERROR."
 msgstr ""
 

BIN
po/ja.gmo


+ 55 - 41
po/ja.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: aria2c 0.2.1\n"
 "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
-"POT-Creation-Date: 2006-10-01 22:14+0900\n"
+"POT-Creation-Date: 2006-10-18 23:54+0900\n"
 "PO-Revision-Date: 2006-10-01 22:31+0900\n"
 "Last-Translator: Tatsuhiro Tsujikawa <tujikawa@rednoah.com>\n"
 "Language-Team: Japanese <ja@li.org>\n"
@@ -16,11 +16,11 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=1; plural=0;\n"
 
-#: src/TorrentMan.cc:678
+#: src/TorrentMan.cc:685
 msgid "Download of selected files was complete."
 msgstr "ご指定のファイルのダウンロードが完了."
 
-#: src/TorrentMan.cc:681
+#: src/TorrentMan.cc:688
 msgid "The download was complete."
 msgstr "ダウンロードが完了."
 
@@ -34,6 +34,7 @@ msgstr ""
 "<%s> のダウンロードが完了しました.\n"
 
 #: src/RequestInfo.h:105
+#, c-format
 msgid ""
 "\n"
 "The download was not complete because of errors. Check the log.\n"
@@ -368,15 +369,17 @@ msgstr "
 msgid "Failed to peek data, cause: %s"
 msgstr "データの peek に失敗しました. 原因: %s"
 
-#: src/DownloadEngineFactory.cc:114
+#: src/DownloadEngineFactory.cc:110
+#, c-format
 msgid "Errors occurred while binding port.\n"
 msgstr "ポートをバインド中にエラーが発生しました.\n"
 
-#: src/TorrentRequestInfo.cc:88
+#: src/TorrentRequestInfo.cc:90
 msgid "Files:"
 msgstr "ファイル:"
 
 #: src/UrlRequestInfo.cc:76
+#, c-format
 msgid ""
 "\n"
 "stopping application...\n"
@@ -385,6 +388,7 @@ msgstr ""
 "アプリケーションを終了しています...\n"
 
 #: src/UrlRequestInfo.cc:81
+#, c-format
 msgid "done\n"
 msgstr "完了\n"
 
@@ -428,7 +432,8 @@ msgstr ""
 "\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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n"
+"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  "
+"USA\n"
 
 #: src/main.cc:108
 #, c-format
@@ -658,11 +663,14 @@ msgid ""
 "download.\n"
 "                              Default: 0"
 msgstr ""
-" --lowest-speed-limit=SPEED   ここで指定するダウンロード速度を下回った場合, ダ\n"
+" --lowest-speed-limit=SPEED   ここで指定するダウンロード速度を下回った場合, "
+"ダ\n"
 "                              ウンロードを中止します. 速度はバイト/秒です.\n"
 "                              0 を指定すると, 速度の判定を行いません.\n"
-"                              K または M を付加することができます (1K = 1024,\n"
-"                              1M = 1024K). このオプションは, BitTorrent ダウンロ\n"
+"                              K または M を付加することができます (1K = "
+"1024,\n"
+"                              1M = 1024K). このオプションは, BitTorrent ダウ"
+"ンロ\n"
 "                              ードには影響しません.\n"
 "                              デフォルト値: 0"
 
@@ -673,9 +681,12 @@ msgid ""
 "                              You can append K or M(1K = 1024, 1M = 1024K).\n"
 "                              Default: 0"
 msgstr ""
-" --max-download-limit=SPEED   ダウンロードの最大速度 (バイト/秒) を指定します.\n"
-"                              0 を指定すると速度の制限をしません. K または Mを\n"
-"                              付加することができます (1K = 1024, 1M = 1024K).\n"
+" --max-download-limit=SPEED   ダウンロードの最大速度 (バイト/秒) を指定しま"
+"す.\n"
+"                              0 を指定すると速度の制限をしません. K または M"
+"を\n"
+"                              付加することができます (1K = 1024, 1M = "
+"1024K).\n"
 "                              デフォルト値: 0"
 
 #: src/main.cc:180
@@ -730,9 +741,12 @@ msgid ""
 "                              You can append K or M(1K = 1024, 1M = 1024K).\n"
 "                              Default: 0"
 msgstr ""
-" --max-upload-limit=SPEED     アップロードの最大速度 (バイト/秒) を指定します.\n"
-"                              0 を指定すると速度の制限をしません. K または Mを\n"
-"                              付加することができます (1K = 1024, 1M = 1024K).\n"
+" --max-upload-limit=SPEED     アップロードの最大速度 (バイト/秒) を指定しま"
+"す.\n"
+"                              0 を指定すると速度の制限をしません. K または M"
+"を\n"
+"                              付加することができます (1K = 1024, 1M = "
+"1024K).\n"
 "                              デフォルト値: 0"
 
 #: src/main.cc:194
@@ -912,99 +926,99 @@ msgstr " 
 msgid "Report bugs to %s"
 msgstr "バグレポートはこちらへ: %s"
 
-#: src/main.cc:401
+#: src/main.cc:403
 msgid "unrecognized proxy format"
 msgstr "理解できないProxyフォーマットです."
 
-#: src/main.cc:428
+#: src/main.cc:430
 msgid "Currently, supported authentication scheme is basic."
 msgstr "現在サポートされている認証方法は basic です."
 
-#: src/main.cc:437
+#: src/main.cc:439
 msgid "retry-wait must be between 0 and 60."
 msgstr "retry-wait は 0 から 60 の間で指定してください."
 
-#: src/main.cc:454
+#: src/main.cc:456
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgstr "ftp-type は 'binary' または 'ascii' を指定してください."
 
-#: src/main.cc:463
+#: src/main.cc:465
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgstr "ftp-via-http-proxy は 'get' または 'tunnel' を指定してください."
 
-#: src/main.cc:471
+#: src/main.cc:473
 msgid "min-segment-size invalid"
 msgstr "min-segment-size が不正です."
 
-#: src/main.cc:482
+#: src/main.cc:484
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgstr "http-proxy-method は 'get' または 'tunnel' を指定してください."
 
-#: src/main.cc:490
+#: src/main.cc:492
 msgid "listen-port must be between 1024 and 65535."
 msgstr "listen-port は 1024 - 65535 の値を指定してください."
 
-#: src/main.cc:503
+#: src/main.cc:505
 msgid "follow-torrent must be either 'true' or 'false'."
 msgstr "follow-torrent は 'true' または 'false を指定してください."
 
-#: src/main.cc:517
+#: src/main.cc:519
 msgid "direct-file-mapping must be either 'true' or 'false'."
 msgstr "direct-file-mapping は 'true' または 'false を指定してください."
 
-#: src/main.cc:528
+#: src/main.cc:530
 msgid "upload-limit must be greater than or equal to 0."
 msgstr "upload-limit は 0 以上の数を指定してください."
 
-#: src/main.cc:541
+#: src/main.cc:543
 msgid "seed-time must be greater than or equal to 0."
 msgstr "seed-time は 0 以上の数を指定してください."
 
-#: src/main.cc:551
+#: src/main.cc:553
 msgid "seed-ratio must be greater than or equal to 0.0."
 msgstr "seed-ratio は 0.0 以上の数を指定してください."
 
-#: src/main.cc:561
+#: src/main.cc:563
 msgid "max-upload-limit must be greater than or equal to 0"
 msgstr "max-upload-limit は 0 以上の数を指定してください."
 
-#: src/main.cc:583
+#: src/main.cc:585
 msgid "follow-metalink must be either 'true' or 'false'."
 msgstr "follow-metalink は 'true' または 'false を指定してください."
 
-#: src/main.cc:591
+#: src/main.cc:593
 msgid "lowest-speed-limit must be greater than or equal to 0"
 msgstr "lowest-speed-limit は 0 以上の数を指定してください."
 
-#: src/main.cc:601
+#: src/main.cc:603
 msgid "max-download-limit must be greater than or equal to 0"
 msgstr "max-download-limit は 0 以上の数を指定してください."
 
-#: src/main.cc:630
+#: src/main.cc:632
 msgid "split must be between 1 and 5."
 msgstr "split は 1 - 5 の値を指定してください."
 
-#: src/main.cc:643
+#: src/main.cc:645
 msgid "timeout must be between 1 and 600"
 msgstr "timeout は 1 - 600 の値を指定してください."
 
-#: src/main.cc:652
+#: src/main.cc:654
 msgid "max-tries invalid"
 msgstr "max-tries が不正です."
 
-#: src/main.cc:674
+#: src/main.cc:676
 msgid "metalink-servers must be greater than 0."
 msgstr "metalink-servers は 0 以上の数を指定してください."
 
-#: src/main.cc:694
+#: src/main.cc:696
 msgid "specify at least one URL"
 msgstr "一個以上の URL を指定してください."
 
-#: src/main.cc:701
+#: src/main.cc:703
 msgid "daemon failed"
 msgstr "デーモン起動に失敗"
 
-#: src/main.cc:764
+#: src/main.cc:766
 msgid ""
 "Now verifying checksum.\n"
 "This may take some time depending on your PC environment and the size of "
@@ -1013,11 +1027,11 @@ msgstr ""
 "チェックサムを検査しています.\n"
 "お使いの PC 環境とファイルサイズにより, ある程度の時間がかかります."
 
-#: src/main.cc:768
+#: src/main.cc:770
 msgid "checksum OK."
 msgstr "チェックサム OK."
 
-#: src/main.cc:771
+#: src/main.cc:773
 msgid "checksum ERROR."
 msgstr "チェックサム エラー."
 

BIN
po/ru.gmo


+ 35 - 32
po/ru.po

@@ -10,7 +10,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ru\n"
 "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
-"POT-Creation-Date: 2006-10-01 22:14+0900\n"
+"POT-Creation-Date: 2006-10-18 23:54+0900\n"
 "PO-Revision-Date: 2006-07-28 18:04+0600\n"
 "Last-Translator: Azamat H. Hackimov <azamat.hackimov@gmail.com>\n"
 "Language-Team:  <ru@li.org>\n"
@@ -21,12 +21,12 @@ msgstr ""
 "10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
 "X-Generator: KBabel 1.11.2\n"
 
-#: src/TorrentMan.cc:678
+#: src/TorrentMan.cc:685
 #, fuzzy
 msgid "Download of selected files was complete."
 msgstr " Скачать только выбранные файлы:"
 
-#: src/TorrentMan.cc:681
+#: src/TorrentMan.cc:688
 #, fuzzy
 msgid "The download was complete."
 msgstr ""
@@ -43,7 +43,7 @@ msgstr ""
 "Скачивание завершено. <%s>\n"
 
 #: src/RequestInfo.h:105
-#, fuzzy
+#, fuzzy, c-format
 msgid ""
 "\n"
 "The download was not complete because of errors. Check the log.\n"
@@ -371,15 +371,17 @@ msgstr "Ошибка получения данных: %s"
 msgid "Failed to peek data, cause: %s"
 msgstr "Ошибка запроса данных: %s"
 
-#: src/DownloadEngineFactory.cc:114
+#: src/DownloadEngineFactory.cc:110
+#, c-format
 msgid "Errors occurred while binding port.\n"
 msgstr "Ошибка при открытии порта.\n"
 
-#: src/TorrentRequestInfo.cc:88
+#: src/TorrentRequestInfo.cc:90
 msgid "Files:"
 msgstr "Файлы:"
 
 #: src/UrlRequestInfo.cc:76
+#, c-format
 msgid ""
 "\n"
 "stopping application...\n"
@@ -388,6 +390,7 @@ msgstr ""
 "остановка приложения...\n"
 
 #: src/UrlRequestInfo.cc:81
+#, c-format
 msgid "done\n"
 msgstr "завершено\n"
 
@@ -879,115 +882,115 @@ msgstr " Скачивание metalink с настройками:"
 msgid "Report bugs to %s"
 msgstr "Сообщения об ошибках направляйте на адрес %s"
 
-#: src/main.cc:401
+#: src/main.cc:403
 msgid "unrecognized proxy format"
 msgstr "неизвестный формат прокси"
 
-#: src/main.cc:428
+#: src/main.cc:430
 msgid "Currently, supported authentication scheme is basic."
 msgstr "Поддерживаемая схема аутентификации - \"basic\"."
 
-#: src/main.cc:437
+#: src/main.cc:439
 msgid "retry-wait must be between 0 and 60."
 msgstr "retry-wait должен быть в пределах 0..60"
 
-#: src/main.cc:454
+#: src/main.cc:456
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgstr "ftp-type должен быть \"binary\" или \"ascii\"."
 
-#: src/main.cc:463
+#: src/main.cc:465
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgstr "ftp-via-http-proxy должен быть \"get\" или \"tunnel\"."
 
-#: src/main.cc:471
+#: src/main.cc:473
 msgid "min-segment-size invalid"
 msgstr "min-segment-size неверен"
 
-#: src/main.cc:482
+#: src/main.cc:484
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgstr "http-proxy-method должен быть \"get\" или \"tunnel\"."
 
-#: src/main.cc:490
+#: src/main.cc:492
 msgid "listen-port must be between 1024 and 65535."
 msgstr "listen-port должен быть в пределах 1024..65535."
 
-#: src/main.cc:503
+#: src/main.cc:505
 msgid "follow-torrent must be either 'true' or 'false'."
 msgstr "follow-torrent должен быть 'true' или 'false'."
 
-#: src/main.cc:517
+#: src/main.cc:519
 msgid "direct-file-mapping must be either 'true' or 'false'."
 msgstr "direct-file-mapping должен быть 'true' или 'false'."
 
-#: src/main.cc:528
+#: src/main.cc:530
 msgid "upload-limit must be greater than or equal to 0."
 msgstr "upload-limit должен быть не меньше 0."
 
-#: src/main.cc:541
+#: src/main.cc:543
 #, fuzzy
 msgid "seed-time must be greater than or equal to 0."
 msgstr "upload-limit должен быть не меньше 0."
 
-#: src/main.cc:551
+#: src/main.cc:553
 #, fuzzy
 msgid "seed-ratio must be greater than or equal to 0.0."
 msgstr "upload-limit должен быть не меньше 0."
 
-#: src/main.cc:561
+#: src/main.cc:563
 #, fuzzy
 msgid "max-upload-limit must be greater than or equal to 0"
 msgstr "upload-limit должен быть не меньше 0."
 
-#: src/main.cc:583
+#: src/main.cc:585
 msgid "follow-metalink must be either 'true' or 'false'."
 msgstr "follow-metalink должен быть 'true' или 'false'."
 
-#: src/main.cc:591
+#: src/main.cc:593
 #, fuzzy
 msgid "lowest-speed-limit must be greater than or equal to 0"
 msgstr "upload-limit должен быть не меньше 0."
 
-#: src/main.cc:601
+#: src/main.cc:603
 #, fuzzy
 msgid "max-download-limit must be greater than or equal to 0"
 msgstr "upload-limit должен быть не меньше 0."
 
-#: src/main.cc:630
+#: src/main.cc:632
 msgid "split must be between 1 and 5."
 msgstr "split должен быть находится в пределах 1..5."
 
-#: src/main.cc:643
+#: src/main.cc:645
 msgid "timeout must be between 1 and 600"
 msgstr "таймаут должен быть в пределах 1..600"
 
-#: src/main.cc:652
+#: src/main.cc:654
 msgid "max-tries invalid"
 msgstr "неверный max-tries"
 
-#: src/main.cc:674
+#: src/main.cc:676
 msgid "metalink-servers must be greater than 0."
 msgstr "metalink-servers должен быть больше 0"
 
-#: src/main.cc:694
+#: src/main.cc:696
 msgid "specify at least one URL"
 msgstr "укажите по крайней мере один URL"
 
-#: src/main.cc:701
+#: src/main.cc:703
 msgid "daemon failed"
 msgstr "ошибка демона"
 
-#: src/main.cc:764
+#: src/main.cc:766
 msgid ""
 "Now verifying checksum.\n"
 "This may take some time depending on your PC environment and the size of "
 "file."
 msgstr ""
 
-#: src/main.cc:768
+#: src/main.cc:770
 msgid "checksum OK."
 msgstr ""
 
-#: src/main.cc:771
+#: src/main.cc:773
 msgid "checksum ERROR."
 msgstr ""
 

+ 4 - 2
src/AbstractCommand.cc

@@ -41,7 +41,9 @@
 #include "SleepCommand.h"
 #include "prefs.h"
 
-AbstractCommand::AbstractCommand(int cuid, Request* req, DownloadEngine* e,
+AbstractCommand::AbstractCommand(int cuid,
+				 const RequestHandle req,
+				 DownloadEngine* e,
 				 const SocketHandle& s):
   Command(cuid), req(req), e(e), socket(s),
   checkSocketIsReadable(false), checkSocketIsWritable(false),
@@ -125,7 +127,7 @@ bool AbstractCommand::execute() {
 
 void AbstractCommand::tryReserved() {
   if(!e->segmentMan->reserved.empty()) {
-    Request* req = e->segmentMan->reserved.front();
+    RequestHandle req = e->segmentMan->reserved.front();
     e->segmentMan->reserved.pop_front();
     Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, e);
     e->commands.push_back(command);

+ 2 - 2
src/AbstractCommand.h

@@ -46,7 +46,7 @@ private:
   Time checkPoint;
   int timeout;
 protected:
-  Request* req;
+  RequestHandle req;
   DownloadEngine* e;
   SocketHandle socket;
 
@@ -73,7 +73,7 @@ private:
   SocketHandle writeCheckTarget;
   bool nameResolverCheck;
 public:
-  AbstractCommand(int cuid, Request* req, DownloadEngine* e, const SocketHandle& s = SocketHandle());
+  AbstractCommand(int cuid, const RequestHandle req, DownloadEngine* e, const SocketHandle& s = SocketHandle());
   virtual ~AbstractCommand();
   bool execute();
 };

+ 225 - 0
src/AnnounceList.cc

@@ -0,0 +1,225 @@
+/* <!-- copyright */
+/*
+ * aria2 - The high speed download utility
+ *
+ * Copyright (C) 2006 Tatsuhiro Tsujikawa
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * In addition, as a special exception, the copyright holders give
+ * permission to link the code of portions of this program with the
+ * OpenSSL library under certain conditions as described in each
+ * individual source file, and distribute linked combinations
+ * including the two.
+ * You must obey the GNU General Public License in all respects
+ * for all of the code used other than OpenSSL.  If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so.  If you
+ * do not wish to do so, delete this exception statement from your
+ * version.  If you delete this exception statement from all source
+ * files in the program, then also delete it here.
+ */
+/* copyright --> */
+#include "AnnounceList.h"
+#include "List.h"
+#include "Data.h"
+
+AnnounceList::AnnounceList(const MetaEntry* announceListEntry):
+  currentTrackerInitialized(false) {
+  reconfigure(announceListEntry);
+}
+
+AnnounceList::AnnounceList(const AnnounceTiers& announceTiers):
+  tiers(announceTiers), currentTrackerInitialized(false)  {
+  resetIterator();
+}
+
+void AnnounceList::reconfigure(const MetaEntry* announceListEntry) {
+  const List* l = dynamic_cast<const List*>(announceListEntry);
+  if(l) {
+    for(MetaList::const_iterator itr = l->getList().begin();
+	itr != l->getList().end(); itr++) {
+      const List* elem = (List*)*itr;
+      Strings urls;
+      for(MetaList::const_iterator elemItr = elem->getList().begin();
+	  elemItr != elem->getList().end(); elemItr++) {
+	const Data* data = (Data*)*elemItr;
+	urls.push_back(data->toString());
+      }
+      if(urls.size()) {
+	AnnounceTier tier(urls);
+	tiers.push_back(tier);
+      }
+    }
+    resetIterator();
+  }
+}
+
+void AnnounceList::reconfigure(const string& url) {
+  Strings urls;
+  urls.push_back(url);
+  tiers.push_back(AnnounceTier(urls));
+  resetIterator();
+}
+
+void AnnounceList::resetIterator() {
+  currentTier = tiers.begin();
+  if(currentTier != tiers.end() && currentTier->urls.size()) {
+    currentTracker = currentTier->urls.begin();
+    currentTrackerInitialized = true;
+  } else {
+    currentTrackerInitialized = false;
+  }
+}
+
+string AnnounceList::getAnnounce() const {
+  if(currentTrackerInitialized) {
+    return *currentTracker;
+  } else {
+    return "";
+  }
+}
+
+void AnnounceList::announceSuccess() {
+  if(currentTrackerInitialized) {
+    currentTier->nextEvent();
+    string url = *currentTracker;
+    currentTier->urls.erase(currentTracker);
+    currentTier->urls.push_front(url);
+    currentTier = tiers.begin();
+    currentTracker = currentTier->urls.begin();
+  }
+}
+
+void AnnounceList::announceFailure() {
+  if(currentTrackerInitialized) {
+    currentTracker++;
+    if(currentTracker == currentTier->urls.end()) {
+      currentTier++;
+      if(currentTier == tiers.end()) {
+	currentTier = tiers.begin();
+      }
+      currentTracker = currentTier->urls.begin();
+    }
+  }
+}
+
+AnnounceTier::AnnounceEvent AnnounceList::getEvent() const {
+  if(currentTrackerInitialized) {
+    return currentTier->event;
+  } else {
+    return AnnounceTier::STARTED;
+  }
+}
+
+void AnnounceList::setEvent(AnnounceTier::AnnounceEvent event) {
+  if(currentTrackerInitialized) {
+    currentTier->event = event;
+  }
+}
+
+string AnnounceList::getEventString() const {
+  if(currentTrackerInitialized) {
+    switch(currentTier->event) {
+    case AnnounceTier::STARTED:
+    case AnnounceTier::STARTED_AFTER_COMPLETION:
+      return "started";
+    case AnnounceTier::STOPPED:
+      return "stopped";
+    case AnnounceTier::COMPLETED:
+      return "completed";
+    default:
+      return "";
+    }
+  } else {
+    return "";
+  }
+}
+
+class FindStoppedAllowedTier {
+public:
+  bool operator()(const AnnounceTier& tier) const {
+    switch(tier.event) {
+    case AnnounceTier::DOWNLOADING:
+    case AnnounceTier::STOPPED:
+    case AnnounceTier::COMPLETED:
+    case AnnounceTier::SEEDING:
+      return true;
+    default:
+      return false;
+    }
+  }
+};
+
+class FindCompletedAllowedTier {
+public:
+  bool operator()(const AnnounceTier& tier) const {
+    switch(tier.event) {
+    case AnnounceTier::DOWNLOADING:
+    case AnnounceTier::COMPLETED:
+      return true;
+    default:
+      return false;
+    }
+  }
+};
+
+int AnnounceList::countStoppedAllowedTier() const {
+  return count_if(tiers.begin(), tiers.end(), FindStoppedAllowedTier());
+}
+
+int AnnounceList::countCompletedAllowedTier() const {
+  return count_if(tiers.begin(), tiers.end(), FindCompletedAllowedTier());
+}
+
+void AnnounceList::setCurrentTier(const AnnounceTiers::iterator& itr) {
+  if(itr != tiers.end()) {
+    currentTier = itr;
+    currentTracker = currentTier->urls.begin();
+  }
+}
+
+template<class InputIterator, class Predicate>
+InputIterator
+find_wrap_if(InputIterator first, InputIterator last,
+	     InputIterator current, Predicate pred) {
+  InputIterator itr = find_if(current, last,
+			      pred);
+  if(itr == last) {
+    itr = find_if(first, current, pred);
+  }
+  return itr;
+}
+
+void AnnounceList::moveToStoppedAllowedTier() {
+  AnnounceTiers::iterator itr = find_wrap_if(tiers.begin(), tiers.end(),
+					     currentTier,
+					     FindStoppedAllowedTier());
+  setCurrentTier(itr);
+}
+
+void AnnounceList::moveToCompletedAllowedTier() {
+  AnnounceTiers::iterator itr = find_wrap_if(tiers.begin(), tiers.end(),
+					     currentTier,
+					     FindCompletedAllowedTier());
+  setCurrentTier(itr);
+}
+
+void AnnounceList::shuffle() {
+  for(AnnounceTiers::iterator itr = tiers.begin();
+      itr != tiers.end(); itr++) {
+    random_shuffle(itr->urls.begin(), itr->urls.end());
+  }
+}

+ 158 - 0
src/AnnounceList.h

@@ -0,0 +1,158 @@
+/* <!-- copyright */
+/*
+ * aria2 - The high speed download utility
+ *
+ * Copyright (C) 2006 Tatsuhiro Tsujikawa
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * In addition, as a special exception, the copyright holders give
+ * permission to link the code of portions of this program with the
+ * OpenSSL library under certain conditions as described in each
+ * individual source file, and distribute linked combinations
+ * including the two.
+ * You must obey the GNU General Public License in all respects
+ * for all of the code used other than OpenSSL.  If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so.  If you
+ * do not wish to do so, delete this exception statement from your
+ * version.  If you delete this exception statement from all source
+ * files in the program, then also delete it here.
+ */
+/* copyright --> */
+#ifndef _D_ANNOUNCE_LIST_H_
+#define _D_ANNOUNCE_LIST_H_
+
+#include "common.h"
+#include "MetaEntry.h"
+
+class AnnounceTier {
+public:
+  enum AnnounceEvent {
+    STARTED,
+    STARTED_AFTER_COMPLETION,
+    DOWNLOADING,
+    STOPPED,
+    COMPLETED,
+    SEEDING,
+    HALTED
+  };
+
+  AnnounceEvent event;
+  Strings urls;
+
+  AnnounceTier(const Strings& urls):event(STARTED), urls(urls) {}
+
+  void nextEvent() {
+    switch(event) {
+    case STARTED:
+      event = DOWNLOADING;
+      break;
+    case STARTED_AFTER_COMPLETION:
+      event = SEEDING;
+      break;
+    case STOPPED:
+      event = HALTED;
+      break;
+    case COMPLETED:
+      event = SEEDING;
+      break;
+    default:
+      break;
+    }
+  }
+};
+
+typedef deque<AnnounceTier> AnnounceTiers;
+
+class AnnounceList {
+public:
+private:
+  AnnounceTiers tiers;
+  AnnounceTiers::iterator currentTier;
+  Strings::iterator currentTracker;
+  bool currentTrackerInitialized;
+
+  void resetIterator();
+  void setCurrentTier(const AnnounceTiers::iterator& itr);
+public:
+  AnnounceList():currentTrackerInitialized(false) {}
+  AnnounceList(const MetaEntry* announceListEntry);
+  AnnounceList(const AnnounceTiers& tiers);
+
+  void reconfigure(const MetaEntry* announceListEntry);
+  void reconfigure(const string& url);
+
+  int countTier() const {
+    return tiers.size();
+  }
+
+  /**
+   * Shuffles all the URLs in each group.
+   */
+  void shuffle();
+
+  /**
+   * Returns announce URL.
+   */
+  string getAnnounce() const;
+
+  /**
+   * Returns announce event, such as started, stopped, completed, etc.
+   */
+  string getEventString() const;
+
+  AnnounceTier::AnnounceEvent getEvent() const;
+
+  void setEvent(AnnounceTier::AnnounceEvent event);
+
+  /**
+   * Removes current announce URL from its group and inserts it before the
+   * first element of the group.
+   * The internal announce group pointer points to the first element of the
+   * first group after this call.
+   */
+  void announceSuccess();
+
+  /**
+   * The internal announce URL pointer points to next URL.
+   * If the current URL is the last element of its group, then the first
+   * element of the next group is pointed.
+   */
+  void announceFailure();
+
+  /**
+   * Counts the number of tiers to which the "stopped" event can be sent.
+   */
+  int countStoppedAllowedTier() const;
+
+  /**
+   * Counts the number of tiers to which the "completed" event can be sent.
+   */
+  int countCompletedAllowedTier() const;
+
+  /**
+   * Moves current tier pointer to the tier to which the "stopped" event can
+   * be sent.
+   * 2-stage search operation is made.
+   * The first search operation is performed from current pointer position
+   * to the end. If no such tier is found, the second search is performed from
+   * the first to the current pointer position.
+   */
+  void moveToStoppedAllowedTier();
+  void moveToCompletedAllowedTier();
+};
+
+#endif // _D_ANNOUNCE_LIST_H_

+ 3 - 1
src/DownloadCommand.cc

@@ -42,7 +42,9 @@
 #include "prefs.h"
 #include <sys/time.h>
 
-DownloadCommand::DownloadCommand(int cuid, Request* req, DownloadEngine* e,
+DownloadCommand::DownloadCommand(int cuid,
+				 const RequestHandle req,
+				 DownloadEngine* e,
 				 const SocketHandle& s):
   AbstractCommand(cuid, req, e, s), lastSize(0) {
   PeerStatHandle peerStat = PeerStatHandle(new PeerStat(cuid));

+ 1 - 1
src/DownloadCommand.h

@@ -49,7 +49,7 @@ protected:
 
   virtual bool prepareForNextSegment(const Segment& currentSegment);
 public:
-  DownloadCommand(int cuid, Request* req, DownloadEngine* e,
+  DownloadCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 		  const SocketHandle& s);
   virtual ~DownloadCommand();
 

+ 0 - 4
src/DownloadEngineFactory.cc

@@ -80,9 +80,6 @@ DownloadEngineFactory::newTorrentConsoleEngine(const Option* op,
 					       const string& torrentFile,
 					       const Strings& targetFiles)
 {
-  Request* req = new Request();
-  req->isTorrent = true;
-  req->setTrackerEvent(Request::STARTED);
   TorrentConsoleDownloadEngine* te = new TorrentConsoleDownloadEngine();
   te->option = op;
   ByteArrayDiskWriter* byteArrayDiskWriter = new ByteArrayDiskWriter();
@@ -92,7 +89,6 @@ DownloadEngineFactory::newTorrentConsoleEngine(const Option* op,
   te->torrentMan = new TorrentMan();
   te->torrentMan->setStoreDir(op->get(PREF_DIR));
   te->torrentMan->option = op;
-  te->torrentMan->req = req;
   Integers selectIndexes;
   Util::unfoldRange(op->get(PREF_SELECT_FILE), selectIndexes);
   if(selectIndexes.size()) {

+ 1 - 1
src/FtpConnection.cc

@@ -41,7 +41,7 @@
 #include "LogFactory.h"
 
 FtpConnection::FtpConnection(int cuid, const SocketHandle& socket,
-			     const Request* req, const Option* op)
+			     const RequestHandle req, const Option* op)
   :cuid(cuid), socket(socket), req(req), option(op) {
   logger = LogFactory::getInstance();
 }

+ 2 - 2
src/FtpConnection.h

@@ -49,7 +49,7 @@ class FtpConnection {
 private:
   int cuid;
   SocketHandle socket;
-  const Request* req;
+  RequestHandle req;
   const Option* option;
   const Logger* logger;
 
@@ -60,7 +60,7 @@ private:
   bool bulkReceiveResponse(pair<int, string>& response);
 public:
   FtpConnection(int cuid, const SocketHandle& socket,
-		const Request* req, const Option* op);
+		const RequestHandle req, const Option* op);
   ~FtpConnection();
   void sendUser() const;
   void sendPass() const;

+ 2 - 1
src/FtpDownloadCommand.cc

@@ -34,7 +34,8 @@
 /* copyright --> */
 #include "FtpDownloadCommand.h"
 
-FtpDownloadCommand::FtpDownloadCommand(int cuid, Request* req,
+FtpDownloadCommand::FtpDownloadCommand(int cuid,
+				       const RequestHandle req,
 				       DownloadEngine* e,
 				       const SocketHandle& dataSocket,
 				       const SocketHandle& ctrlSocket)

+ 1 - 1
src/FtpDownloadCommand.h

@@ -41,7 +41,7 @@ class FtpDownloadCommand : public DownloadCommand {
 private:
   SocketHandle ctrlSocket;
 public:
-  FtpDownloadCommand(int cuid, Request* req, DownloadEngine* e,
+  FtpDownloadCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 		     const SocketHandle& dataSocket,
 		     const SocketHandle& ctrlSocket);
   ~FtpDownloadCommand();

+ 1 - 1
src/FtpInitiateConnectionCommand.cc

@@ -42,7 +42,7 @@
 #include "Util.h"
 
 FtpInitiateConnectionCommand::FtpInitiateConnectionCommand(int cuid,
-							   Request* req,
+							   const RequestHandle req,
 							   DownloadEngine* e)
   :AbstractCommand(cuid, req, e)
 {

+ 1 - 1
src/FtpInitiateConnectionCommand.h

@@ -54,7 +54,7 @@ private:
 protected:
   bool executeInternal(Segment& segment);
 public:
-  FtpInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e);
+  FtpInitiateConnectionCommand(int cuid, const RequestHandle req, DownloadEngine* e);
   ~FtpInitiateConnectionCommand();
 };
 

+ 1 - 1
src/FtpNegotiationCommand.cc

@@ -39,7 +39,7 @@
 #include "message.h"
 #include "prefs.h"
 
-FtpNegotiationCommand::FtpNegotiationCommand(int cuid, Request* req,
+FtpNegotiationCommand::FtpNegotiationCommand(int cuid, const RequestHandle req,
 					     DownloadEngine* e,
 					     const SocketHandle& s):
   AbstractCommand(cuid, req, e, s), sequence(SEQ_RECV_GREETING)

+ 1 - 1
src/FtpNegotiationCommand.h

@@ -93,7 +93,7 @@ private:
 protected:
   bool executeInternal(Segment& segment);
 public:
-  FtpNegotiationCommand(int cuid, Request* req, DownloadEngine* e,
+  FtpNegotiationCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 			const SocketHandle& s);
   ~FtpNegotiationCommand();
 };

+ 2 - 1
src/FtpTunnelRequestCommand.cc

@@ -36,7 +36,8 @@
 #include "FtpTunnelResponseCommand.h"
 #include "HttpConnection.h"
 
-FtpTunnelRequestCommand::FtpTunnelRequestCommand(int cuid, Request* req,
+FtpTunnelRequestCommand::FtpTunnelRequestCommand(int cuid,
+						 const RequestHandle req,
 						 DownloadEngine* e,
 						 const SocketHandle& s)
   :AbstractCommand(cuid, req, e, s) {

+ 1 - 1
src/FtpTunnelRequestCommand.h

@@ -41,7 +41,7 @@ class FtpTunnelRequestCommand : public AbstractCommand {
 protected:
   bool executeInternal(Segment& segment);
 public:
-  FtpTunnelRequestCommand(int cuid, Request* req, DownloadEngine* e,
+  FtpTunnelRequestCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 			  const SocketHandle& s);
   ~FtpTunnelRequestCommand();
 };

+ 2 - 1
src/FtpTunnelResponseCommand.cc

@@ -37,7 +37,8 @@
 #include "DlRetryEx.h"
 #include "message.h"
 
-FtpTunnelResponseCommand::FtpTunnelResponseCommand(int cuid, Request* req,
+FtpTunnelResponseCommand::FtpTunnelResponseCommand(int cuid,
+						   const RequestHandle req,
 						   DownloadEngine* e,
 						   const SocketHandle& s)
   :AbstractCommand(cuid, req, e, s) {

+ 1 - 1
src/FtpTunnelResponseCommand.h

@@ -44,7 +44,7 @@ private:
 protected:
     bool executeInternal(Segment& segment);
 public:
-  FtpTunnelResponseCommand(int cuid, Request* req, DownloadEngine* e,
+  FtpTunnelResponseCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 			   const SocketHandle& s);
   ~FtpTunnelResponseCommand();
 };

+ 1 - 1
src/HttpConnection.cc

@@ -41,7 +41,7 @@
 #include "LogFactory.h"
 
 HttpConnection::HttpConnection(int cuid, const SocketHandle& socket,
-			       const Request* req, const Option* op):
+			       const RequestHandle req, const Option* op):
   cuid(cuid), socket(socket), req(req), option(op), headerBufLength(0) {
   logger = LogFactory::getInstance();
 }

+ 2 - 2
src/HttpConnection.h

@@ -60,13 +60,13 @@ private:
   string getProxyAuthString() const;
   int cuid;
   SocketHandle socket;
-  const Request* req;
+  RequestHandle req;
   const Option* option;
   const Logger* logger;
   char headerBuf[HEADERBUF_SIZE+1];
   int headerBufLength;
 public:
-  HttpConnection(int cuid, const SocketHandle& socket, const Request* req,
+  HttpConnection(int cuid, const SocketHandle& socket, const RequestHandle req,
 		 const Option* op);
 
   /**

+ 1 - 1
src/HttpDownloadCommand.cc

@@ -45,7 +45,7 @@
 
 using namespace std;
 
-HttpDownloadCommand::HttpDownloadCommand(int cuid, Request* req,
+HttpDownloadCommand::HttpDownloadCommand(int cuid, const RequestHandle req,
 					 DownloadEngine* e,
 					 const SocketHandle& socket)
   :DownloadCommand(cuid, req, e, socket)

+ 1 - 1
src/HttpDownloadCommand.h

@@ -52,7 +52,7 @@ private:
 protected:
   virtual bool prepareForNextSegment(const Segment& currentSegment);
 public:
-  HttpDownloadCommand(int cuid, Request* req, DownloadEngine* e,
+  HttpDownloadCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 		      const SocketHandle& s);
   ~HttpDownloadCommand();
 

+ 1 - 1
src/HttpInitiateConnectionCommand.cc

@@ -42,7 +42,7 @@
 #include "prefs.h"
 
 HttpInitiateConnectionCommand::HttpInitiateConnectionCommand(int cuid,
-							     Request* req,
+							     const RequestHandle req,
 							     DownloadEngine* e):
   AbstractCommand(cuid, req, e)
 {

+ 1 - 1
src/HttpInitiateConnectionCommand.h

@@ -62,7 +62,7 @@ protected:
   }
 #endif // ENABLE_ASYNC_DNS
 public:
-  HttpInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e);
+  HttpInitiateConnectionCommand(int cuid, const RequestHandle req, DownloadEngine* e);
   ~HttpInitiateConnectionCommand();
 };
 

+ 2 - 1
src/HttpProxyRequestCommand.cc

@@ -36,7 +36,8 @@
 #include "HttpConnection.h"
 #include "HttpProxyResponseCommand.h"
 
-HttpProxyRequestCommand::HttpProxyRequestCommand(int cuid, Request* req,
+HttpProxyRequestCommand::HttpProxyRequestCommand(int cuid,
+						 const RequestHandle req,
 						 DownloadEngine* e,
 						 const SocketHandle& s)
   :AbstractCommand(cuid, req, e, s) {

+ 1 - 1
src/HttpProxyRequestCommand.h

@@ -41,7 +41,7 @@ class HttpProxyRequestCommand : public AbstractCommand {
 protected:
   bool executeInternal(Segment& segment);
 public:
-  HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e,
+  HttpProxyRequestCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 			  const SocketHandle& s);
   ~HttpProxyRequestCommand();
 };

+ 2 - 1
src/HttpProxyResponseCommand.cc

@@ -37,7 +37,8 @@
 #include "DlRetryEx.h"
 #include "message.h"
 
-HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid, Request* req,
+HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid,
+						   const RequestHandle req,
 						   DownloadEngine* e,
 						   const SocketHandle& s)
   :AbstractCommand(cuid, req, e, s) {

+ 1 - 1
src/HttpProxyResponseCommand.h

@@ -44,7 +44,7 @@ private:
 protected:
   bool executeInternal(Segment& segment);
 public:
-  HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e,
+  HttpProxyResponseCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 			   const SocketHandle& s);
   ~HttpProxyResponseCommand();
 };

+ 2 - 1
src/HttpRequestCommand.cc

@@ -37,7 +37,8 @@
 #include "HttpConnection.h"
 #include "prefs.h"
 
-HttpRequestCommand::HttpRequestCommand(int cuid, Request* req,
+HttpRequestCommand::HttpRequestCommand(int cuid,
+				       const RequestHandle req,
 				       DownloadEngine* e,
 				       const SocketHandle& s)
   :AbstractCommand(cuid, req, e, s) {

+ 1 - 1
src/HttpRequestCommand.h

@@ -42,7 +42,7 @@ protected:
   bool executeInternal(Segment& segment);
   Command* getNextCommand() const;
 public:
-  HttpRequestCommand(int cuid, Request* req, DownloadEngine* e,
+  HttpRequestCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 		     const SocketHandle& s);
   ~HttpRequestCommand();
 };

+ 2 - 1
src/HttpResponseCommand.cc

@@ -43,7 +43,8 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-HttpResponseCommand::HttpResponseCommand(int cuid, Request* req,
+HttpResponseCommand::HttpResponseCommand(int cuid,
+					 const RequestHandle req,
 					 DownloadEngine* e,
 					 const SocketHandle& s)
   :AbstractCommand(cuid, req, e, s) {

+ 1 - 1
src/HttpResponseCommand.h

@@ -54,7 +54,7 @@ private:
 protected:
   bool executeInternal(Segment& segment);
 public:
-  HttpResponseCommand(int cuid, Request* req, DownloadEngine* e,
+  HttpResponseCommand(int cuid, const RequestHandle req, DownloadEngine* e,
 		      const SocketHandle& s);
   ~HttpResponseCommand();
 };

+ 1 - 1
src/InitiateConnectionCommandFactory.cc

@@ -37,7 +37,7 @@
 #include "FtpInitiateConnectionCommand.h"
 #include "DlAbortEx.h"
 
-Command* InitiateConnectionCommandFactory::createInitiateConnectionCommand(int cuid, Request* req, DownloadEngine* e) {
+Command* InitiateConnectionCommandFactory::createInitiateConnectionCommand(int cuid, const RequestHandle req, DownloadEngine* e) {
   if(req->getProtocol() == "http"
 #ifdef ENABLE_SSL
      // for SSL

+ 2 - 1
src/InitiateConnectionCommandFactory.h

@@ -41,7 +41,8 @@
 
 class InitiateConnectionCommandFactory {
 public:
-  static Command* createInitiateConnectionCommand(int cuid, Request* req, 
+  static Command* createInitiateConnectionCommand(int cuid,
+						  const RequestHandle req, 
 						  DownloadEngine* e);
 };
 

+ 2 - 1
src/Makefile.am

@@ -124,7 +124,8 @@ SRCS += MetaEntry.h\
 	PeerListProcessor.h\
 	DefaultPeerListProcessor.cc DefaultPeerListProcessor.h\
 	CompactPeerListProcessor.cc CompactPeerListProcessor.h\
-	DelegatingPeerListProcessor.cc DelegatingPeerListProcessor.h
+	DelegatingPeerListProcessor.cc DelegatingPeerListProcessor.h\
+	AnnounceList.h AnnounceList.cc
 endif # ENABLE_BITTORRENT
 
 if ENABLE_METALINK

+ 24 - 15
src/Makefile.in

@@ -101,7 +101,8 @@ bin_PROGRAMS = aria2c$(EXEEXT)
 @ENABLE_BITTORRENT_TRUE@	PeerListProcessor.h\
 @ENABLE_BITTORRENT_TRUE@	DefaultPeerListProcessor.cc DefaultPeerListProcessor.h\
 @ENABLE_BITTORRENT_TRUE@	CompactPeerListProcessor.cc CompactPeerListProcessor.h\
-@ENABLE_BITTORRENT_TRUE@	DelegatingPeerListProcessor.cc DelegatingPeerListProcessor.h
+@ENABLE_BITTORRENT_TRUE@	DelegatingPeerListProcessor.cc DelegatingPeerListProcessor.h\
+@ENABLE_BITTORRENT_TRUE@	AnnounceList.h AnnounceList.cc
 
 @ENABLE_METALINK_TRUE@am__append_3 = Metalinker.cc Metalinker.h\
 @ENABLE_METALINK_TRUE@	MetalinkEntry.cc MetalinkEntry.h\
@@ -117,14 +118,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
 	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
 	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
 	$(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
-	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
-	$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/nls.m4 \
-	$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
-	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
-	$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isc-posix.m4 \
+	$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libares.m4 $(top_srcdir)/m4/libcares.m4 \
+	$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
+	$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -210,9 +211,9 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
 	PeerListProcessor.h DefaultPeerListProcessor.cc \
 	DefaultPeerListProcessor.h CompactPeerListProcessor.cc \
 	CompactPeerListProcessor.h DelegatingPeerListProcessor.cc \
-	DelegatingPeerListProcessor.h Metalinker.cc Metalinker.h \
-	MetalinkEntry.cc MetalinkEntry.h MetalinkResource.cc \
-	MetalinkResource.h MetalinkProcessor.h \
+	DelegatingPeerListProcessor.h AnnounceList.h AnnounceList.cc \
+	Metalinker.cc Metalinker.h MetalinkEntry.cc MetalinkEntry.h \
+	MetalinkResource.cc MetalinkResource.h MetalinkProcessor.h \
 	Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h \
 	MetalinkRequestInfo.cc MetalinkRequestInfo.h
 @ENABLE_ASYNC_DNS_TRUE@am__objects_1 = NameResolver.$(OBJEXT)
@@ -268,7 +269,8 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
 @ENABLE_BITTORRENT_TRUE@	SeedCheckCommand.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	DefaultPeerListProcessor.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	CompactPeerListProcessor.$(OBJEXT) \
-@ENABLE_BITTORRENT_TRUE@	DelegatingPeerListProcessor.$(OBJEXT)
+@ENABLE_BITTORRENT_TRUE@	DelegatingPeerListProcessor.$(OBJEXT) \
+@ENABLE_BITTORRENT_TRUE@	AnnounceList.$(OBJEXT)
 @ENABLE_METALINK_TRUE@am__objects_3 = Metalinker.$(OBJEXT) \
 @ENABLE_METALINK_TRUE@	MetalinkEntry.$(OBJEXT) \
 @ENABLE_METALINK_TRUE@	MetalinkResource.$(OBJEXT) \
@@ -364,6 +366,7 @@ EXEEXT = @EXEEXT@
 GENCAT = @GENCAT@
 GLIBC21 = @GLIBC21@
 GMSGFMT = @GMSGFMT@
+GREP = @GREP@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -418,10 +421,9 @@ XML2_CONFIG = @XML2_CONFIG@
 XML_CPPFLAGS = @XML_CPPFLAGS@
 XML_LIBS = @XML_LIBS@
 YACC = @YACC@
+YFLAGS = @YFLAGS@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -438,12 +440,16 @@ build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
@@ -454,8 +460,10 @@ localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
@@ -586,6 +594,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbstractCommand.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AbstractDiskWriter.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AllowedFastMessage.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AnnounceList.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldMan.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldMessage.Po@am__quote@

+ 3 - 1
src/Request.h

@@ -39,6 +39,7 @@
 #include "CookieBox.h"
 #include "Segment.h"
 #include "common.h"
+#include "SharedHandle.h"
 
 using namespace std;
 
@@ -120,6 +121,7 @@ public:
 
 };
 
-typedef deque<Request*> Requests;
+typedef SharedHandle<Request> RequestHandle;
+typedef deque<RequestHandle> Requests;
 
 #endif // _D_REQUEST_H_

+ 10 - 3
src/TorrentMan.cc

@@ -72,7 +72,7 @@ TorrentMan::TorrentMan():bitfield(0),
 			 incomplete(0),
 			 connections(0),
 			 trackers(0),
-			 req(0),
+			 trackerNumTry(0),
 			 diskAdaptor(0)
 {
   logger = LogFactory::getInstance();
@@ -81,7 +81,6 @@ TorrentMan::TorrentMan():bitfield(0),
 TorrentMan::~TorrentMan() {
   delete bitfield;
   delete diskAdaptor;
-  delete req;
 }
 
 // TODO do not use this method in application code
@@ -447,7 +446,15 @@ void TorrentMan::setupInternal1(const string& metaInfoFile) {
   Directory* topDir = NULL;
   readFileEntry(fileEntries, &topDir, infoDic, metaInfoFile);
 
-  announce = ((Data*)topDic->get("announce"))->toString();
+  string announce = ((Data*)topDic->get("announce"))->toString();
+  const MetaEntry* announces = topDic->get("announce-list");
+  if(announces) {
+    announceList.reconfigure(announces);
+    announceList.shuffle();
+  }
+  if(!announceList.countTier()) {
+    announceList.reconfigure(announce);
+  }
   pieceLength = ((Data*)infoDic->get("piece length"))->toInt();
   pieces = totalLength/pieceLength+(totalLength%pieceLength ? 1 : 0);
   Data* piecesHashData = (Data*)infoDic->get("pieces");

+ 3 - 2
src/TorrentMan.h

@@ -45,7 +45,7 @@
 #include "Option.h"
 #include "FileEntry.h"
 #include "DiskAdaptor.h"
-#include "Request.h"
+#include "AnnounceList.h"
 #include "TimeA2.h"
 #include "PeerListProcessor.h"
 #include <deque>
@@ -142,8 +142,9 @@ public:
   int connections;
   // The number of tracker request command currently in the command queue.
   int trackers;
+  int trackerNumTry;
   // tracker request
-  Request* req;
+  AnnounceList announceList;
 public:
   TorrentMan();
   ~TorrentMan();

+ 2 - 0
src/TorrentRequestInfo.cc

@@ -54,6 +54,8 @@ RequestInfo* TorrentRequestInfo::execute() {
   if(!timeoutSpecified) {
     op->put(PREF_TIMEOUT, "180");
   }
+  // set max_tries to 1. AnnounceList handles retries.
+  op->put(PREF_MAX_TRIES, "1");
   e = DownloadEngineFactory::newTorrentConsoleEngine(op,
 						     torrentFile,
 						     targetFiles);

+ 5 - 9
src/TrackerUpdateCommand.cc

@@ -155,21 +155,17 @@ bool TrackerUpdateCommand::execute() {
     if(!peersEntry) {
       logger->info("CUID#%d - No peer list received.", cuid);
     }
-
-    if(e->torrentMan->req->getTrackerEvent() == Request::STARTED) {
-      e->torrentMan->req->setTrackerEvent(Request::AUTO);
-    }
+    e->torrentMan->announceList.announceSuccess();
+    e->torrentMan->trackers = 0;
+    e->segmentMan->init();
   } catch(Exception* err) {
     logger->error("CUID#%d - Error occurred while processing tracker response.", cuid, err);
+    e->segmentMan->errors++;
     delete err;
   }
-  if(trackerResponse != NULL) {
+  if(trackerResponse) {
     delete [] trackerResponse;
   }
-  e->torrentMan->trackers = 0;
-
-  e->segmentMan->init();
-
   if(e->torrentMan->isHalt()) {
     return true;
   } else {

+ 81 - 66
src/TrackerWatcherCommand.cc

@@ -49,83 +49,98 @@ TrackerWatcherCommand::TrackerWatcherCommand(int cuid,
 TrackerWatcherCommand::~TrackerWatcherCommand() {}
 
 bool TrackerWatcherCommand::execute() {
-  if(e->segmentMan->errors > 0) {
-    if(e->torrentMan->isHalt()) {
+  Command* command = 0;
+  if(e->torrentMan->trackers == 0 && e->torrentMan->isHalt()) {
+    // Download is going to halt.
+    // Check whether there are at least one tracker which can receive
+    // "stopped" event.
+    if(e->torrentMan->announceList.countStoppedAllowedTier()) {
+      e->torrentMan->announceList.moveToStoppedAllowedTier();
+      e->torrentMan->announceList.setEvent(AnnounceTier::STOPPED);
+      command = createRequestCommand();
+    } else {
+      // We don't send "stopped" event since no tracker cares about it.
       return true;
     }
+  } else if(e->torrentMan->trackers == 0 &&
+	    e->torrentMan->downloadComplete() &&
+	    e->torrentMan->announceList.countCompletedAllowedTier()) {
+    // Send "completed" event to all trackers which can accept it.
+    e->torrentMan->announceList.moveToCompletedAllowedTier();
+    e->torrentMan->announceList.setEvent(AnnounceTier::COMPLETED);
+    command = createRequestCommand();
+  } else if(e->torrentMan->trackers == 0 &&
+	    checkPoint.elapsed(interval)) {
+    checkPoint.reset();
+    // If download completed before "started" event is sent to a tracker,
+    // we change the event to something else to prevent us from
+    // sending "completed" event.
+    if(e->torrentMan->downloadComplete() &&
+       e->torrentMan->announceList.getEvent() == AnnounceTier::STARTED) {
+      e->torrentMan->announceList.setEvent(AnnounceTier::STARTED_AFTER_COMPLETION);
+    }
+    command = createRequestCommand();
+  } else if(e->segmentMan->errors > 0) {
+    e->torrentMan->trackerNumTry++;
+    checkPoint.reset();
     // we assume the tracker request has failed.
+    e->torrentMan->announceList.announceFailure();
     e->torrentMan->trackers = 0;
     e->segmentMan->init();
-    // sleep a few seconds.
-    SleepCommand* sleepCommand =
-      new SleepCommand(cuid, e, this, e->option->getAsInt(PREF_RETRY_WAIT));
-    e->commands.push_back(sleepCommand);
-    return false;
-  }
-  if(e->torrentMan->trackers == 0 &&
-     (e->torrentMan->isHalt() ||
-      checkPoint.elapsed(interval))) {
-    checkPoint.reset();
-    e->torrentMan->req->resetTryCount();
-    int numWant = 50;
-    if(e->torrentMan->connections >= MIN_PEERS || e->torrentMan->isHalt()) {
-      numWant = 0;
-    }
-    if(e->torrentMan->isHalt()) {
-      e->torrentMan->req->setTrackerEvent(Request::STOPPED);
-    } else if(e->torrentMan->downloadComplete()) {
-      if(e->torrentMan->req->getTrackerEvent() == Request::COMPLETED) {
-	e->torrentMan->req->setTrackerEvent(Request::AFTER_COMPLETED);
-      } else {
-	if(e->torrentMan->req->getTrackerEvent() == Request::STARTED) {
-	  // in case where download had completed when aria2c started.
-	  e->torrentMan->req->setTrackerEvent(Request::AFTER_COMPLETED);
-	} else if(e->torrentMan->req->getTrackerEvent() != Request::AFTER_COMPLETED) {
-	  e->torrentMan->req->setTrackerEvent(Request::COMPLETED);
-	}
+    if(e->torrentMan->trackerNumTry >= e->option->getAsInt(PREF_TRACKER_MAX_TRIES)) {
+      // abort tracker request
+      e->torrentMan->trackerNumTry = 0;
+      if(e->torrentMan->isHalt()) {
+	return true;
       }
+    } else {
+      // sleep a few seconds.
+      command =
+	new SleepCommand(cuid, e,
+			 createRequestCommand(),
+			 e->option->getAsInt(PREF_RETRY_WAIT));
     }
-    string event;
-    switch(e->torrentMan->req->getTrackerEvent()) {
-    case Request::STARTED:
-      event = "started";
-      break;
-    case Request::STOPPED:
-      event = "stopped";
-      break;
-    case Request::COMPLETED:
-      event = "completed";
-      break;
-    }
-    string url = e->torrentMan->announce+"?"+
-      "info_hash="+Util::torrentUrlencode(e->torrentMan->getInfoHash(), 20)+"&"+
-      "peer_id="+e->torrentMan->peerId+"&"+
-      "port="+Util::itos(e->torrentMan->getPort())+"&"+
-      "uploaded="+Util::llitos(e->torrentMan->getSessionUploadLength())+"&"+
-      "downloaded="+Util::llitos(e->torrentMan->getSessionDownloadLength())+"&"+
-      "left="+(e->torrentMan->getTotalLength()-e->torrentMan->getDownloadLength() <= 0
-	       ? "0" : Util::llitos(e->torrentMan->getTotalLength()-e->torrentMan->getDownloadLength()))+"&"+
-      "compact=1"+"&"+
-      "key="+e->torrentMan->key+"&"+
-      "numwant="+Util::itos(numWant)+"&"+
-      "no_peer_id=1";
-    if(!event.empty()) {
-      url += string("&")+"event="+event;
-    }
-    if(!e->torrentMan->trackerId.empty()) {
-      url += string("&")+"trackerid="+e->torrentMan->trackerId;
-    }
-    e->torrentMan->req->setUrl(url);
-    Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(e->torrentMan->getNewCuid(), e->torrentMan->req, e);
+  }
+
+  if(command) {
     e->commands.push_back(command);
     e->torrentMan->trackers++;
-    logger->info("CUID#%d - Creating new tracker request command #%d", cuid,
-		 command->getCuid());
-    if(e->torrentMan->isHalt()) {
-      return true;
-    }
   }
+  // updates interval with newest minInterval
   interval = e->torrentMan->minInterval;
   e->commands.push_back(this);
   return false;
 }
+
+Command* TrackerWatcherCommand::createRequestCommand() {
+  int numWant = 50;
+  if(e->torrentMan->connections >= MIN_PEERS || e->torrentMan->isHalt()) {
+    numWant = 0;
+  }
+  string url = e->torrentMan->announceList.getAnnounce()+"?"+
+    "info_hash="+Util::torrentUrlencode(e->torrentMan->getInfoHash(), 20)+"&"+
+    "peer_id="+e->torrentMan->peerId+"&"+
+    "port="+Util::itos(e->torrentMan->getPort())+"&"+
+    "uploaded="+Util::llitos(e->torrentMan->getSessionUploadLength())+"&"+
+    "downloaded="+Util::llitos(e->torrentMan->getSessionDownloadLength())+"&"+
+    "left="+(e->torrentMan->getTotalLength()-e->torrentMan->getDownloadLength() <= 0
+	     ? "0" : Util::llitos(e->torrentMan->getTotalLength()-e->torrentMan->getDownloadLength()))+"&"+
+    "compact=1"+"&"+
+    "key="+e->torrentMan->key+"&"+
+    "numwant="+Util::itos(numWant)+"&"+
+    "no_peer_id=1";
+  string event = e->torrentMan->announceList.getEventString();
+  if(!event.empty()) {
+    url += string("&")+"event="+event;
+  }
+  if(!e->torrentMan->trackerId.empty()) {
+    url += string("&")+"trackerid="+e->torrentMan->trackerId;
+  }
+  RequestHandle req;
+  req->setUrl(url);
+  req->isTorrent = true;
+  Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(e->torrentMan->getNewCuid(), req, e);
+  logger->info("CUID#%d - Creating new tracker request command #%d", cuid,
+	       command->getCuid());
+  return command;
+}

+ 2 - 0
src/TrackerWatcherCommand.h

@@ -44,6 +44,8 @@ private:
   TorrentDownloadEngine* e;
   int interval;
   Time checkPoint;
+
+  Command* createRequestCommand();
 public:
   TrackerWatcherCommand(int cuid, TorrentDownloadEngine* e, int interval);
   ~TrackerWatcherCommand();

+ 1 - 5
src/UrlRequestInfo.cc

@@ -97,14 +97,13 @@ public:
 
   void operator()(const string& url) {
     for(int s = 1; s <= split; s++) {
-      Request* req = new Request();
+      RequestHandle req;
       req->setReferer(referer);
       if(req->setUrl(url)) {
 	requestsPtr->push_back(req);
       } else {
 	fprintf(stderr, _("Unrecognized URL or unsupported protocol: %s\n"),
 		req->getUrl().c_str());
-	delete req;
       }
     }
   }
@@ -146,9 +145,6 @@ RequestInfo* UrlRequestInfo::execute() {
     delete e;
     fail = true;
   }
-  for_each(requests.begin(), requests.end(), Deleter());
-  for_each(reserved.begin(), reserved.end(), Deleter());
-  
   setSignalHander(SIGINT, SIG_DFL, 0);
   setSignalHander(SIGTERM, SIG_DFL, 0);
   

+ 1 - 3
src/Util.cc

@@ -221,9 +221,7 @@ string Util::urldecode(const string& target) {
   string result;
   for(string::const_iterator itr = target.begin();
       itr != target.end(); itr++) {
-    if(*itr == '+') {
-      result += ' ';
-    } else if(*itr == '%') {
+    if(*itr == '%') {
       if(itr+1 != target.end() && itr+2 != target.end() &&
 	 isxdigit(*(itr+1)) && isxdigit(*(itr+2))) {
 	char temp[3];

+ 1 - 0
src/main.cc

@@ -332,6 +332,7 @@ int main(int argc, char* argv[]) {
   op->put(PREF_MAX_DOWNLOAD_LIMIT, "0");
   op->put(PREF_MAX_UPLOAD_LIMIT, "0");
   op->put(PREF_STARTUP_IDLE_TIME, "10");
+  op->put(PREF_TRACKER_MAX_TRIES, "10");
   while(1) {
     int optIndex = 0;
     int lopt;

+ 3 - 1
src/prefs.h

@@ -53,7 +53,7 @@
 // values: 1*digit
 #define PREF_DNS_TIMEOUT "dns_timeout"
 // values: 1*digit
-#define PREF_MAX_TRIES "max_try"
+#define PREF_MAX_TRIES "max_tries"
 // values: 1*digit
 #define PREF_MIN_SEGMENT_SIZE "min_segment_size"
 // values: 1*digit
@@ -149,6 +149,8 @@
 #define PREF_SEED_TIME "seed_time"
 // values: 1*digit ['.' [ 1*digit ] ]
 #define PREF_SEED_RATIO "seed_ratio"
+// values: 1*digit
+#define PREF_TRACKER_MAX_TRIES "tracker_max_tries"
 
 /**
  * Metalink related preferences

+ 273 - 0
test/AnnounceListTest.cc

@@ -0,0 +1,273 @@
+#include "AnnounceList.h"
+#include "MetaFileUtil.h"
+#include "Exception.h"
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace std;
+
+class AnnounceListTest:public CppUnit::TestFixture {
+
+  CPPUNIT_TEST_SUITE(AnnounceListTest);
+  CPPUNIT_TEST(testSingleElementList);
+  CPPUNIT_TEST(testMultiElementList);
+  CPPUNIT_TEST(testSingleAndMulti);
+  CPPUNIT_TEST(testNoGroup);
+  CPPUNIT_TEST(testCountStoppedAllowedTier);
+  CPPUNIT_TEST(testCountCompletedAllowedTier);
+  CPPUNIT_TEST(testMoveToStoppedAllowedTier);
+  CPPUNIT_TEST(testMoveToCompletedAllowedTier);
+  CPPUNIT_TEST_SUITE_END();
+private:
+
+public:
+  void setUp() {
+  }
+
+  void testSingleElementList();
+  void testMultiElementList();
+  void testSingleAndMulti();
+  void testNoGroup();
+  void testEvent();
+  void testCountStoppedAllowedTier();
+  void testCountCompletedAllowedTier();
+  void testMoveToStoppedAllowedTier();
+  void testMoveToCompletedAllowedTier();
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( AnnounceListTest );
+
+void AnnounceListTest::testSingleElementList() {
+  string peersString = "ll8:tracker1el8:tracker2el8:tracker3ee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+
+  // ANNOUNCE_LIST
+  // [ [ tracker1 ], [ tracker2 ], [ tracker3 ] ]
+  AnnounceList announceList(announces);
+
+  string url =  announceList.getAnnounce();
+  string event = announceList.getEventString();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  CPPUNIT_ASSERT_EQUAL(string("started"), event);
+  announceList.announceFailure();
+  url =  announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+  announceList.announceFailure();
+  url =  announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker3"), url);
+  announceList.announceFailure();
+  // back to the first list
+  url = announceList.getAnnounce();
+  event = announceList.getEventString();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  CPPUNIT_ASSERT_EQUAL(string("started"), event);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  event = announceList.getEventString();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+  CPPUNIT_ASSERT_EQUAL(string("started"), event);
+  announceList.announceSuccess();
+  // back to the first list because announce to tracker2 succeeded.
+  url = announceList.getAnnounce();
+  event = announceList.getEventString();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  CPPUNIT_ASSERT_EQUAL(string("started"), event);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  event = announceList.getEventString();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+  CPPUNIT_ASSERT_EQUAL(string(""), event);
+}
+
+void AnnounceListTest::testMultiElementList() {
+  string peersString = "ll8:tracker18:tracker28:tracker3ee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+  // ANNOUNCE_LIST
+  // [ [ tracker1, tracker2, tracker3 ] ]
+  AnnounceList announceList(announces);
+  
+  string url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+  announceList.announceSuccess();
+  url = announceList.getAnnounce();
+  // tracker2 returns because tracker2 is now first.
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker3"), url);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  // back to the first list because there is no other list.
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+}
+
+void AnnounceListTest::testSingleAndMulti() {
+  string peersString = "ll8:tracker18:tracker2el8:tracker3ee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+
+  // ANNOUNCE_LIST
+  // [ [ tracker1, tracker2 ], [ tracker3 ] ]
+  AnnounceList announceList(announces);
+
+  string url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  announceList.announceSuccess();
+  url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), url);
+  announceList.announceFailure();
+  url = announceList.getAnnounce();
+  CPPUNIT_ASSERT_EQUAL(string("tracker3"), url);
+  announceList.announceSuccess();
+  url = announceList.getAnnounce();
+  // tracker1 returns because after the announce to tracker3 succeeds, list
+  // pointer points to the first list.
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), url);
+}
+
+void AnnounceListTest::testNoGroup() {
+  string peersString = "llee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+
+  AnnounceList announceList(announces);
+
+  CPPUNIT_ASSERT(announceList.countTier() == 0);
+}
+
+void AnnounceListTest::testEvent() {
+  string peersString = "ll8:tracker1el8:tracker2el8:tracker3ee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+
+  // ANNOUNCE_LIST
+  // [ [ tracker1 ], [ tracker2 ], [ tracker3 ] ]
+  AnnounceList announceList(announces);
+
+  announceList.setEvent(AnnounceTier::STOPPED);
+  announceList.announceSuccess();
+  CPPUNIT_ASSERT_EQUAL(string(""), announceList.getEventString());
+  CPPUNIT_ASSERT_EQUAL(AnnounceTier::HALTED, announceList.getEvent());
+
+  announceList.setEvent(AnnounceTier::COMPLETED);
+  announceList.announceSuccess();
+  CPPUNIT_ASSERT_EQUAL(string(""), announceList.getEventString());
+  CPPUNIT_ASSERT_EQUAL(AnnounceTier::SEEDING, announceList.getEvent());
+
+  announceList.setEvent(AnnounceTier::STARTED_AFTER_COMPLETION);
+  CPPUNIT_ASSERT_EQUAL(string("started"), announceList.getEventString());
+  announceList.announceSuccess();
+  CPPUNIT_ASSERT_EQUAL(AnnounceTier::SEEDING, announceList.getEvent());
+}
+
+void AnnounceListTest::testCountStoppedAllowedTier() {
+  string peersString = "ll8:tracker1el8:tracker2el8:tracker3ee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+
+  // ANNOUNCE_LIST
+  // [ [ tracker1 ], [ tracker2 ], [ tracker3 ] ]
+  AnnounceList announceList(announces);
+
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
+  announceList.setEvent(AnnounceTier::STARTED);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
+  announceList.setEvent(AnnounceTier::STARTED_AFTER_COMPLETION);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
+  announceList.setEvent(AnnounceTier::HALTED);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countStoppedAllowedTier());
+
+  announceList.setEvent(AnnounceTier::DOWNLOADING);
+  CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
+  announceList.setEvent(AnnounceTier::STOPPED);
+  CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
+  announceList.setEvent(AnnounceTier::COMPLETED);
+  CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
+  announceList.setEvent(AnnounceTier::SEEDING);
+  CPPUNIT_ASSERT_EQUAL(1, announceList.countStoppedAllowedTier());
+
+}
+
+void AnnounceListTest::testCountCompletedAllowedTier() {
+  string peersString = "ll8:tracker1el8:tracker2el8:tracker3ee";
+  Dictionary* announces = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
+
+  // ANNOUNCE_LIST
+  // [ [ tracker1 ], [ tracker2 ], [ tracker3 ] ]
+  AnnounceList announceList(announces);
+
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
+  announceList.setEvent(AnnounceTier::STARTED);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
+  announceList.setEvent(AnnounceTier::STARTED_AFTER_COMPLETION);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
+  announceList.setEvent(AnnounceTier::STOPPED);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
+  announceList.setEvent(AnnounceTier::SEEDING);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
+  announceList.setEvent(AnnounceTier::HALTED);
+  CPPUNIT_ASSERT_EQUAL(0, announceList.countCompletedAllowedTier());
+
+  announceList.setEvent(AnnounceTier::DOWNLOADING);
+  CPPUNIT_ASSERT_EQUAL(1, announceList.countCompletedAllowedTier());
+  announceList.setEvent(AnnounceTier::COMPLETED);
+  CPPUNIT_ASSERT_EQUAL(1, announceList.countCompletedAllowedTier());
+
+}
+
+Strings createUrls(const string& url) {
+  Strings urls;
+  urls.push_back(url);
+  return urls;
+}
+
+void AnnounceListTest::testMoveToStoppedAllowedTier() {
+  AnnounceTier t1(createUrls("tracker1"));
+  AnnounceTier t2(createUrls("tracker2"));
+  t2.event = AnnounceTier::COMPLETED;
+  AnnounceTier t3(createUrls("tracker3"));
+
+  AnnounceTiers tiers;
+  tiers.push_back(t1);
+  tiers.push_back(t2);
+  tiers.push_back(t3);
+
+  AnnounceList announceList(tiers);
+
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), announceList.getAnnounce());
+  announceList.moveToStoppedAllowedTier();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), announceList.getAnnounce());
+  announceList.announceFailure();
+  CPPUNIT_ASSERT_EQUAL(string("tracker3"), announceList.getAnnounce());
+  // test wrapped search
+  announceList.moveToStoppedAllowedTier();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), announceList.getAnnounce());  
+}
+
+void AnnounceListTest::testMoveToCompletedAllowedTier() {
+  AnnounceTier t1(createUrls("tracker1"));
+  AnnounceTier t2(createUrls("tracker2"));
+  t2.event = AnnounceTier::COMPLETED;
+  AnnounceTier t3(createUrls("tracker3"));
+
+  AnnounceTiers tiers;
+  tiers.push_back(t1);
+  tiers.push_back(t2);
+  tiers.push_back(t3);
+
+  AnnounceList announceList(tiers);
+
+  CPPUNIT_ASSERT_EQUAL(string("tracker1"), announceList.getAnnounce());
+  announceList.moveToStoppedAllowedTier();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), announceList.getAnnounce());
+  announceList.announceFailure();
+  CPPUNIT_ASSERT_EQUAL(string("tracker3"), announceList.getAnnounce());
+  // test wrapped search
+  announceList.moveToStoppedAllowedTier();
+  CPPUNIT_ASSERT_EQUAL(string("tracker2"), announceList.getAnnounce());  
+}

+ 2 - 2
test/DefaultPeerListProcessorTest.cc

@@ -29,8 +29,8 @@ void DefaultPeerListProcessorTest::testExtractPeer() {
   string peersString = "d5:peersld2:ip11:192.168.0.17:peer id20:aria2-000000000000004:porti2006eeee";
 
   Dictionary* dic = (Dictionary*)MetaFileUtil::bdecoding(peersString.c_str(), peersString.size());
-
-  CPPUNIT_ASSERT(proc.canHandle(dic->get("peers"));
+  
+  CPPUNIT_ASSERT(proc.canHandle(dic->get("peers")));
 
   Peers peers = proc.extractPeer(dic->get("peers"));
   CPPUNIT_ASSERT_EQUAL((size_t)1, peers.size());

+ 2 - 1
test/Makefile.am

@@ -40,7 +40,8 @@ aria2c_SOURCES = AllTest.cc\
 	TimeSeedCriteriaTest.cc\
 	SegmentManTest.cc\
 	SpeedCalcTest.cc\
-	DefaultPeerListProcessorTest.cc
+	DefaultPeerListProcessorTest.cc\
+	AnnounceListTest.cc
 #aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
 #aria2c_LDFLAGS = ${CPPUNIT_LIBS}
 

+ 21 - 12
test/Makefile.in

@@ -43,14 +43,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
 	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
 	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
 	$(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
-	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
-	$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/nls.m4 \
-	$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
-	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
-	$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isc-posix.m4 \
+	$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libares.m4 $(top_srcdir)/m4/libcares.m4 \
+	$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
+	$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -77,7 +77,8 @@ am_aria2c_OBJECTS = AllTest.$(OBJEXT) RequestTest.$(OBJEXT) \
 	MetalinkEntryTest.$(OBJEXT) FeatureConfigTest.$(OBJEXT) \
 	ShareRatioSeedCriteriaTest.$(OBJEXT) \
 	TimeSeedCriteriaTest.$(OBJEXT) SegmentManTest.$(OBJEXT) \
-	SpeedCalcTest.$(OBJEXT) DefaultPeerListProcessorTest.$(OBJEXT)
+	SpeedCalcTest.$(OBJEXT) DefaultPeerListProcessorTest.$(OBJEXT) \
+	AnnounceListTest.$(OBJEXT)
 aria2c_OBJECTS = $(am_aria2c_OBJECTS)
 am__DEPENDENCIES_1 =
 aria2c_DEPENDENCIES = ../src/libaria2c.a $(am__DEPENDENCIES_1)
@@ -134,6 +135,7 @@ EXEEXT = @EXEEXT@
 GENCAT = @GENCAT@
 GLIBC21 = @GLIBC21@
 GMSGFMT = @GMSGFMT@
+GREP = @GREP@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -188,10 +190,9 @@ XML2_CONFIG = @XML2_CONFIG@
 XML_CPPFLAGS = @XML_CPPFLAGS@
 XML_LIBS = @XML_LIBS@
 YACC = @YACC@
+YFLAGS = @YFLAGS@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -208,12 +209,16 @@ build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
@@ -224,8 +229,10 @@ localstatedir = @localstatedir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
@@ -271,7 +278,8 @@ aria2c_SOURCES = AllTest.cc\
 	TimeSeedCriteriaTest.cc\
 	SegmentManTest.cc\
 	SpeedCalcTest.cc\
-	DefaultPeerListProcessorTest.cc
+	DefaultPeerListProcessorTest.cc\
+	AnnounceListTest.cc
 
 #aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
 #aria2c_LDFLAGS = ${CPPUNIT_LIBS}
@@ -334,6 +342,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AllTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AllowedFastMessageTest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AnnounceListTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64Test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldManTest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldMessageTest.Po@am__quote@

+ 0 - 12
test/SegmentManTest.cc

@@ -12,7 +12,6 @@ class SegmentManTest:public CppUnit::TestFixture {
   CPPUNIT_TEST(testSaveAndLoad);
   CPPUNIT_TEST(testNullBitfield);
   CPPUNIT_TEST(testCancelSegmentOnNullBitfield);
-  CPPUNIT_TEST(testBug);
   CPPUNIT_TEST_SUITE_END();
 private:
 
@@ -23,7 +22,6 @@ public:
   void testSaveAndLoad();
   void testNullBitfield();
   void testCancelSegmentOnNullBitfield();
-  void testBug();
 };
 
 
@@ -113,13 +111,3 @@ void SegmentManTest::testCancelSegmentOnNullBitfield() {
   segmentMan.cancelSegment(1);
   CPPUNIT_ASSERT(segmentMan.getSegment(segment, 1));
 }
-
-void SegmentManTest::testBug() {
-  SegmentMan segmentMan;
-
-  segmentMan.ufilename = "bug";
-
-  cerr << "########################################" << endl;
-  segmentMan.load();
-
-}

+ 1 - 1
test/UtilTest.cc

@@ -259,7 +259,7 @@ void UtilTest::testUrldecode() {
 		       Util::urldecode(src));
 
   string src2 = "aria2+aria2";
-  CPPUNIT_ASSERT_EQUAL(string("aria2 aria2"), Util::urldecode(src2));
+  CPPUNIT_ASSERT_EQUAL(string("aria2+aria2"), Util::urldecode(src2));
 
   string src3 = "%5t%20";
   CPPUNIT_ASSERT_EQUAL(string("%5t "), Util::urldecode(src3));

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.