Explorar o código

2008-01-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Added --enable-peer-exchange command-line option.
	* src/OptionHandlerFactory.cc
	* src/HelpItemFactory.cc
	* src/option_processing.cc
	* src/usage_text.h
Tatsuhiro Tsujikawa %!s(int64=18) %!d(string=hai) anos
pai
achega
eb718cfda0
Modificáronse 5 ficheiros con 21 adicións e 0 borrados
  1. 8 0
      ChangeLog
  2. 5 0
      src/HelpItemFactory.cc
  3. 1 0
      src/OptionHandlerFactory.cc
  4. 5 0
      src/option_processing.cc
  5. 2 0
      src/usage_text.h

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2008-01-06  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Added --enable-peer-exchange command-line option.
+	* src/OptionHandlerFactory.cc
+	* src/HelpItemFactory.cc
+	* src/option_processing.cc
+	* src/usage_text.h
+
 2008-01-06  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Move extension from BtRuntime to ExtensionMessageFactory, because

+ 5 - 0
src/HelpItemFactory.cc

@@ -329,6 +329,11 @@ TagContainerHandle HelpItemFactory::createHelpItems()
     item->addTag(TAG_BITTORRENT);
     tc->addItem(item);
   }
+  {
+    HelpItemHandle item = new HelpItem(PREF_ENABLE_PEER_EXCHANGE, TEXT_ENABLE_PEER_EXCHANGE, V_TRUE);
+    item->addTag(TAG_BITTORRENT);
+    tc->addItem(item);
+  }
 #endif // ENABLE_BITTORRENT
 #ifdef ENABLE_METALINK
   {

+ 1 - 0
src/OptionHandlerFactory.cc

@@ -108,6 +108,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
     handlers.push_back(new ParameterOptionHandler(PREF_METALINK_PREFERRED_PROTOCOL,
 						  Strings(&params[0], &params[arrayLength(params)])));
   }
+  handlers.push_back(new BooleanOptionHandler(PREF_ENABLE_PEER_EXCHANGE));
 
   return handlers;
 }

+ 5 - 0
src/option_processing.cc

@@ -200,6 +200,7 @@ Option* option_processing(int argc, char* const argv[])
       { "seed-ratio", required_argument, &lopt, 23 },
       { "max-upload-limit", required_argument, &lopt, 24 },
       { "peer-id-prefix", required_argument, &lopt, 25 },
+      { "enable-peer-exchange", optional_argument, &lopt, 26 },
 #endif // ENABLE_BITTORRENT
 #ifdef ENABLE_METALINK
       { "metalink-file", required_argument, NULL, 'M' },
@@ -291,6 +292,10 @@ Option* option_processing(int argc, char* const argv[])
 	break;
       case 25:
 	cmdstream << PREF_PEER_ID_PREFIX << "=" << optarg << "\n";
+	break;
+      case 26:
+	cmdstream << PREF_ENABLE_PEER_EXCHANGE << "=" << toBoolArg(optarg) << "\n";
+	break;
       case 100:
 	cmdstream << PREF_METALINK_VERSION << "=" << optarg << "\n";
 	break;

+ 2 - 0
src/usage_text.h

@@ -254,6 +254,8 @@ _(" --peer-id-prefix=PEERI_ID_PREFIX Specify the prefix of peer ID. The peer ID
   "                              specified, the random alphabet characters are\n"\
   "                              added to make it's length 20 bytes.\n"\
   "                              Default: -aria2-")
+#define TEXT_ENABLE_PEER_EXCHANGE \
+_(" --enable-peer-exchange[=true|false] Enable peer exchange extension.")
 #define TEXT_METALINK_FILE \
 _(" -M, --metalink-file=METALINK_FILE The file path to the .metalink file.")
 #define TEXT_METALINK_SERVERS \