summaryrefslogtreecommitdiff
path: root/src/RpcMethodImpl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/RpcMethodImpl.cc')
-rw-r--r--src/RpcMethodImpl.cc65
1 files changed, 34 insertions, 31 deletions
diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc
index 1142c445..dcf1c84d 100644
--- a/src/RpcMethodImpl.cc
+++ b/src/RpcMethodImpl.cc
@@ -1112,37 +1112,7 @@ SharedHandle<ValueBase> ChangeGlobalOptionRpcMethod::process
Option option;
gatherChangeableGlobalOption(&option, optsParam);
- e->getOption()->merge(option);
-
- if(option.defined(PREF_MAX_OVERALL_DOWNLOAD_LIMIT)) {
- e->getRequestGroupMan()->setMaxOverallDownloadSpeedLimit
- (option.getAsInt(PREF_MAX_OVERALL_DOWNLOAD_LIMIT));
- }
- if(option.defined(PREF_MAX_OVERALL_UPLOAD_LIMIT)) {
- e->getRequestGroupMan()->setMaxOverallUploadSpeedLimit
- (option.getAsInt(PREF_MAX_OVERALL_UPLOAD_LIMIT));
- }
- if(option.defined(PREF_MAX_CONCURRENT_DOWNLOADS)) {
- e->getRequestGroupMan()->setMaxSimultaneousDownloads
- (option.getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS));
- e->getRequestGroupMan()->requestQueueCheck();
- }
- if(option.defined(PREF_MAX_DOWNLOAD_RESULT)) {
- e->getRequestGroupMan()->setMaxDownloadResult
- (option.getAsInt(PREF_MAX_DOWNLOAD_RESULT));
- }
- if(option.defined(PREF_LOG_LEVEL)) {
- LogFactory::setLogLevel(option.get(PREF_LOG_LEVEL));
- }
- if(option.defined(PREF_LOG)) {
- LogFactory::setLogFile(option.get(PREF_LOG));
- try {
- LogFactory::reconfigure();
- } catch(RecoverableException& e) {
- // TODO no exception handling
- }
- }
-
+ changeGlobalOption(option, e);
return VLB_OK;
}
@@ -1542,4 +1512,37 @@ void changeOption
#endif // ENABLE_BITTORRENT
}
+void changeGlobalOption(const Option& option, DownloadEngine* e)
+{
+ e->getOption()->merge(option);
+ if(option.defined(PREF_MAX_OVERALL_DOWNLOAD_LIMIT)) {
+ e->getRequestGroupMan()->setMaxOverallDownloadSpeedLimit
+ (option.getAsInt(PREF_MAX_OVERALL_DOWNLOAD_LIMIT));
+ }
+ if(option.defined(PREF_MAX_OVERALL_UPLOAD_LIMIT)) {
+ e->getRequestGroupMan()->setMaxOverallUploadSpeedLimit
+ (option.getAsInt(PREF_MAX_OVERALL_UPLOAD_LIMIT));
+ }
+ if(option.defined(PREF_MAX_CONCURRENT_DOWNLOADS)) {
+ e->getRequestGroupMan()->setMaxSimultaneousDownloads
+ (option.getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS));
+ e->getRequestGroupMan()->requestQueueCheck();
+ }
+ if(option.defined(PREF_MAX_DOWNLOAD_RESULT)) {
+ e->getRequestGroupMan()->setMaxDownloadResult
+ (option.getAsInt(PREF_MAX_DOWNLOAD_RESULT));
+ }
+ if(option.defined(PREF_LOG_LEVEL)) {
+ LogFactory::setLogLevel(option.get(PREF_LOG_LEVEL));
+ }
+ if(option.defined(PREF_LOG)) {
+ LogFactory::setLogFile(option.get(PREF_LOG));
+ try {
+ LogFactory::reconfigure();
+ } catch(RecoverableException& e) {
+ // TODO no exception handling
+ }
+ }
+}
+
} // namespace aria2