diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-17 22:56:21 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-17 22:56:21 +0900 |
| commit | 06377d77c9a7bf2237f1bfcd5bf79e209b0e2247 (patch) | |
| tree | 3e1b62169574749f50039c4a75450da9c0cb421e /src/RpcMethodImpl.cc | |
| parent | 13e064e4e16aeae9479e1002c3e3fa1ba2cf303c (diff) | |
Add changeGlobalOption, getGlobalOption, getGlobalOptions API
Diffstat (limited to 'src/RpcMethodImpl.cc')
| -rw-r--r-- | src/RpcMethodImpl.cc | 65 |
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 |
