2010-07-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added hidden select-least-used-host option.
	* src/CreateRequestCommand.cc
	* src/OptionHandlerFactory.cc
	* src/TrackerWatcherCommand.cc
	* src/prefs.cc
	* src/prefs.h
pull/1/head
Tatsuhiro Tsujikawa 2010-07-19 05:37:40 +00:00
parent a6a18e9ffe
commit da668763a6
6 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2010-07-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added hidden select-least-used-host option.
* src/CreateRequestCommand.cc
* src/OptionHandlerFactory.cc
* src/TrackerWatcherCommand.cc
* src/prefs.cc
* src/prefs.h
2010-07-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Updated doc for --split option.

View File

@ -72,7 +72,9 @@ bool CreateRequestCommand::executeInternal()
(getSegments().front()->getPositionToWrite()));
}
std::vector<std::pair<size_t, std::string> > usedHosts;
if(getOption()->getAsBool(PREF_SELECT_LEAST_USED_HOST)) {
getDownloadEngine()->getRequestGroupMan()->getUsedHosts(usedHosts);
}
setRequest
(getFileEntry()->getRequest(getRequestGroup()->getURISelector(),
getOption()->getAsBool(PREF_REUSE_URI),

View File

@ -504,6 +504,14 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_ADVANCED);
handlers.push_back(op);
}
{
SharedHandle<OptionHandler> op(new BooleanOptionHandler
(PREF_SELECT_LEAST_USED_HOST,
NO_DEFAULT_VALUE,
V_TRUE));
op->hide();
handlers.push_back(op);
}
{
SharedHandle<OptionHandler> op(new NumberOptionHandler
(PREF_STOP,

View File

@ -242,6 +242,7 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
rg->getOption()->put(PREF_CONNECT_TIMEOUT,
rg->getOption()->get(PREF_BT_TRACKER_CONNECT_TIMEOUT));
rg->getOption()->put(PREF_REUSE_URI, V_FALSE);
rg->getOption()->put(PREF_SELECT_LEAST_USED_HOST, V_FALSE);
static const std::string TRACKER_ANNOUNCE_FILE("[tracker.announce]");
SharedHandle<DownloadContext> dctx
(new DownloadContext(getOption()->getAsInt(PREF_SEGMENT_SIZE),

View File

@ -196,6 +196,8 @@ const std::string PREF_MAX_CONNECTION_PER_SERVER("max-connection-per-server");
const std::string PREF_MIN_SPLIT_SIZE("min-split-size");
// value: true | false
const std::string PREF_CONDITIONAL_GET("conditional-get");
// value: true | false
const std::string PREF_SELECT_LEAST_USED_HOST("select-least-used-host");
/**
* FTP related preferences

View File

@ -200,6 +200,8 @@ extern const std::string PREF_MAX_CONNECTION_PER_SERVER;
extern const std::string PREF_MIN_SPLIT_SIZE;
// value: true | false
extern const std::string PREF_CONDITIONAL_GET;
// value: true | false
extern const std::string PREF_SELECT_LEAST_USED_HOST;
/**
* FTP related preferences