Переглянути джерело

Made --uri-selector option available in -i list.

Tatsuhiro Tsujikawa 14 роки тому
батько
коміт
c8ed44b18f
4 змінених файлів з 11 додано та 7 видалено
  1. 1 0
      doc/aria2c.1.asciidoc
  2. 1 0
      doc/xmlrpc/aria2rpc
  3. 1 0
      src/OptionHandlerFactory.cc
  4. 8 7
      src/RequestGroupMan.cc

+ 1 - 0
doc/aria2c.1.asciidoc

@@ -1613,6 +1613,7 @@ of URIs. These optional lines must start with white space(s).
 * *<<aria2_optref_hash_check_only, hash-check-only>>*
 * *<<aria2_optref_checksum, checksum>>*
 * *<<aria2_optref_piece_length, piece_length>>*
+* *<<aria2_optref_uri_selector, uri-selector>>*
 
 These options have exactly same meaning of the ones in the
 command-line options, but it just applies to the URIs it belongs to.

+ 1 - 0
doc/xmlrpc/aria2rpc

@@ -220,6 +220,7 @@ OptionParser.new do |opt|
   }
   opt.on("--checksum TYPE_DIGEST"){|val| options["checksum"]=val}
   opt.on("--piece-length LENGTH"){|val| options["piece-length"]=val}
+  opt.on("--uri-selector SELECTOR"){|val| options["uri-selector"]=val}
 
   opt.on("--max-overall-download-limit LIMIT"){|val| options["max-overall-download-limit"]=val}
   opt.on("--max-overall-upload-limit LIMIT"){|val| options["max-overall-upload-limit"]=val}

+ 1 - 0
src/OptionHandlerFactory.cc

@@ -930,6 +930,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
                                     (vbegin(params), vend(params))));
     op->addTag(TAG_FTP);
     op->addTag(TAG_HTTP);
+    op->setInitialOption(true);
     handlers.push_back(op);
   }
   // HTTP Specific Options

+ 8 - 7
src/RequestGroupMan.cc

@@ -454,16 +454,17 @@ void RequestGroupMan::removeStoppedGroup(DownloadEngine* e)
 void RequestGroupMan::configureRequestGroup
 (const SharedHandle<RequestGroup>& requestGroup) const
 {
-  const std::string& uriSelectorValue = option_->get(PREF_URI_SELECTOR);
+  const std::string& uriSelectorValue =
+    requestGroup->getOption()->get(PREF_URI_SELECTOR);
+  SharedHandle<URISelector> sel;
   if(uriSelectorValue == V_FEEDBACK) {
-    SharedHandle<URISelector> sel(new FeedbackURISelector(serverStatMan_));
-    requestGroup->setURISelector(sel);
+    sel.reset(new FeedbackURISelector(serverStatMan_));
   } else if(uriSelectorValue == V_INORDER) {
-    SharedHandle<URISelector> sel(new InorderURISelector());
-    requestGroup->setURISelector(sel);
+    sel.reset(new InorderURISelector());
   } else if(uriSelectorValue == V_ADAPTIVE) {
-    SharedHandle<URISelector> sel(new AdaptiveURISelector(serverStatMan_,
-                                                          requestGroup.get()));
+    sel.reset(new AdaptiveURISelector(serverStatMan_, requestGroup.get()));
+  }
+  if(sel) {
     requestGroup->setURISelector(sel);
   }
 }