XmlRpcMethodImpl.cc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2009 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "XmlRpcMethodImpl.h"
  36. #include <cassert>
  37. #include <algorithm>
  38. #include "Logger.h"
  39. #include "BDE.h"
  40. #include "DlAbortEx.h"
  41. #include "Option.h"
  42. #include "OptionParser.h"
  43. #include "OptionHandler.h"
  44. #include "DownloadEngine.h"
  45. #include "RequestGroup.h"
  46. #include "download_helper.h"
  47. #include "Util.h"
  48. #include "RequestGroupMan.h"
  49. #include "StringFormat.h"
  50. #include "XmlRpcRequest.h"
  51. #include "PieceStorage.h"
  52. #include "PeerStorage.h"
  53. #include "BtContext.h"
  54. #include "BtRegistry.h"
  55. #include "Peer.h"
  56. #include "DiskAdaptor.h"
  57. #include "FileEntry.h"
  58. #include "BtProgressInfoFile.h"
  59. #include "BtRuntime.h"
  60. #include "BtAnnounce.h"
  61. #include "prefs.h"
  62. #include "message.h"
  63. namespace aria2 {
  64. namespace xmlrpc {
  65. static const BDE BDE_TRUE = BDE("true");
  66. static const BDE BDE_FALSE = BDE("false");
  67. static const BDE BDE_OK = BDE("OK");
  68. static const BDE BDE_ACTIVE = BDE("active");
  69. static const BDE BDE_WAITING = BDE("waiting");
  70. static const BDE BDE_REMOVED = BDE("removed");
  71. static const BDE BDE_ERROR = BDE("error");
  72. static const BDE BDE_COMPLETE = BDE("complete");
  73. static BDE createGIDResponse(int32_t gid)
  74. {
  75. return BDE(Util::itos(gid));
  76. }
  77. static BDE addRequestGroup(const SharedHandle<RequestGroup>& group,
  78. DownloadEngine* e,
  79. bool posGiven, int pos)
  80. {
  81. if(posGiven) {
  82. e->_requestGroupMan->insertReservedGroup(pos, group);
  83. } else {
  84. e->_requestGroupMan->addReservedGroup(group);
  85. }
  86. return createGIDResponse(group->getGID());
  87. }
  88. static bool hasDictParam(const BDE& params, size_t index)
  89. {
  90. return params.size() > index && params[index].isDict();
  91. }
  92. static void getPosParam(const BDE& params, size_t posParamIndex,
  93. bool& posGiven, size_t& pos)
  94. {
  95. if(params.size() > posParamIndex && params[posParamIndex].isInteger()) {
  96. if(params[posParamIndex].i() >= 0) {
  97. pos = params[posParamIndex].i();
  98. posGiven = true;
  99. } else {
  100. throw DL_ABORT_EX("Position must be greater than or equal to 0.");
  101. }
  102. } else {
  103. posGiven = false;
  104. }
  105. }
  106. BDE AddUriXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e)
  107. {
  108. const BDE& params = req._params;
  109. assert(params.isList());
  110. if(params.empty() || !params[0].isList() || params[0].empty()) {
  111. throw DL_ABORT_EX("URI is not provided.");
  112. }
  113. std::deque<std::string> uris;
  114. for(BDE::List::const_iterator i = params[0].listBegin();
  115. i != params[0].listEnd(); ++i) {
  116. if((*i).isString()) {
  117. uris.push_back((*i).s());
  118. }
  119. }
  120. SharedHandle<Option> requestOption(new Option(*e->option));
  121. if(hasDictParam(params, 1)) {
  122. gatherRequestOption(requestOption, params[1]);
  123. }
  124. size_t pos = 0;
  125. bool posGiven = false;
  126. getPosParam(params, 2, posGiven, pos);
  127. std::deque<SharedHandle<RequestGroup> > result;
  128. createRequestGroupForUri(result, requestOption, uris,
  129. /* ignoreForceSeq = */ true,
  130. /* ignoreNonURI = */ true);
  131. if(!result.empty()) {
  132. return addRequestGroup(result.front(), e, posGiven, pos);
  133. } else {
  134. throw DL_ABORT_EX("No URI to download.");
  135. }
  136. }
  137. #ifdef ENABLE_BITTORRENT
  138. BDE AddTorrentXmlRpcMethod::process
  139. (const XmlRpcRequest& req, DownloadEngine* e)
  140. {
  141. const BDE& params = req._params;
  142. assert(params.isList());
  143. if(params.empty() || !params[0].isString()) {
  144. throw DL_ABORT_EX("Torrent data is not provided.");
  145. }
  146. std::deque<std::string> uris;
  147. if(params.size() > 1 && params[1].isList()) {
  148. for(BDE::List::const_iterator i = params[1].listBegin();
  149. i != params[1].listEnd(); ++i) {
  150. if((*i).isString()) {
  151. uris.push_back((*i).s());
  152. }
  153. }
  154. }
  155. SharedHandle<Option> requestOption(new Option(*e->option));
  156. if(hasDictParam(params, 2)) {
  157. gatherRequestOption(requestOption, params[2]);
  158. }
  159. size_t pos = 0;
  160. bool posGiven = false;
  161. getPosParam(params, 3, posGiven, pos);
  162. std::deque<SharedHandle<RequestGroup> > result;
  163. createRequestGroupForBitTorrent(result, requestOption,
  164. uris,
  165. params[0].s());
  166. if(!result.empty()) {
  167. return addRequestGroup(result.front(), e, posGiven, pos);
  168. } else {
  169. throw DL_ABORT_EX("No Torrent to download.");
  170. }
  171. }
  172. #endif // ENABLE_BITTORRENT
  173. #ifdef ENABLE_METALINK
  174. BDE AddMetalinkXmlRpcMethod::process
  175. (const XmlRpcRequest& req, DownloadEngine* e)
  176. {
  177. const BDE& params = req._params;
  178. assert(params.isList());
  179. if(params.empty() || !params[0].isString()) {
  180. throw DL_ABORT_EX("Metalink data is not provided.");
  181. }
  182. SharedHandle<Option> requestOption(new Option(*e->option));
  183. if(hasDictParam(params, 1)) {
  184. gatherRequestOption(requestOption, params[1]);
  185. };
  186. size_t pos = 0;
  187. bool posGiven = false;
  188. getPosParam(params, 2, posGiven, pos);
  189. std::deque<SharedHandle<RequestGroup> > result;
  190. createRequestGroupForMetalink(result, requestOption, params[0].s());
  191. if(!result.empty()) {
  192. if(posGiven) {
  193. e->_requestGroupMan->insertReservedGroup(pos, result);
  194. } else {
  195. e->_requestGroupMan->addReservedGroup(result);
  196. }
  197. BDE gids = BDE::list();
  198. for(std::deque<SharedHandle<RequestGroup> >::const_iterator i =
  199. result.begin(); i != result.end(); ++i) {
  200. gids << BDE(Util::itos((*i)->getGID()));
  201. }
  202. return gids;
  203. } else {
  204. throw DL_ABORT_EX("No files to download.");
  205. }
  206. }
  207. #endif // ENABLE_METALINK
  208. BDE RemoveXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e)
  209. {
  210. const BDE& params = req._params;
  211. assert(params.isList());
  212. if(params.empty() || !params[0].isString()) {
  213. throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
  214. }
  215. int32_t gid = Util::parseInt(params[0].s());
  216. SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
  217. if(group.isNull()) {
  218. group = e->_requestGroupMan->findReservedGroup(gid);
  219. if(group.isNull()) {
  220. throw DL_ABORT_EX
  221. (StringFormat("Active Download not found for GID#%d", gid).str());
  222. }
  223. if(group->isDependencyResolved()) {
  224. e->_requestGroupMan->removeReservedGroup(gid);
  225. } else {
  226. throw DL_ABORT_EX
  227. (StringFormat("GID#%d cannot be removed now", gid).str());
  228. }
  229. } else {
  230. group->setHaltRequested(true, RequestGroup::USER_REQUEST);
  231. }
  232. return createGIDResponse(gid);
  233. }
  234. static void gatherProgressCommon
  235. (BDE& entryDict, const SharedHandle<RequestGroup>& group)
  236. {
  237. entryDict["gid"] = Util::itos(group->getGID());
  238. // This is "filtered" total length if --select-file is used.
  239. entryDict["totalLength"] = Util::uitos(group->getTotalLength());
  240. // This is "filtered" total length if --select-file is used.
  241. entryDict["completedLength"] = Util::uitos(group->getCompletedLength());
  242. TransferStat stat = group->calculateStat();
  243. entryDict["downloadSpeed"] = Util::uitos(stat.getDownloadSpeed());
  244. entryDict["uploadSpeed"] = Util::uitos(stat.getUploadSpeed());
  245. entryDict["uploadLength"] = Util::uitos(stat.getAllTimeUploadLength());
  246. entryDict["connections"] = Util::uitos(group->getNumConnection());
  247. SharedHandle<PieceStorage> ps = group->getPieceStorage();
  248. if(!ps.isNull()) {
  249. if(ps->getBitfieldLength() > 0) {
  250. entryDict["bitfield"] = Util::toHex(ps->getBitfield(),
  251. ps->getBitfieldLength());
  252. }
  253. }
  254. entryDict["pieceLength"] =
  255. Util::uitos(group->getDownloadContext()->getPieceLength());
  256. entryDict["numPieces"] =
  257. Util::uitos(group->getDownloadContext()->getNumPieces());
  258. }
  259. #ifdef ENABLE_BITTORRENT
  260. static void gatherProgressBitTorrent
  261. (BDE& entryDict, const SharedHandle<BtContext>& btctx,
  262. const SharedHandle<BtRegistry>& btreg)
  263. {
  264. entryDict["infoHash"] = btctx->getInfoHashAsString();
  265. SharedHandle<PeerStorage> peerStorage =
  266. btreg->get(btctx->getInfoHashAsString())._peerStorage;
  267. assert(!peerStorage.isNull());
  268. std::deque<SharedHandle<Peer> > peers;
  269. peerStorage->getActivePeers(peers);
  270. entryDict["numSeeders"] = countSeeder(peers.begin(), peers.end());
  271. }
  272. static void gatherPeer(BDE& peers, const SharedHandle<PeerStorage>& ps)
  273. {
  274. std::deque<SharedHandle<Peer> > activePeers;
  275. ps->getActivePeers(activePeers);
  276. for(std::deque<SharedHandle<Peer> >::const_iterator i =
  277. activePeers.begin(); i != activePeers.end(); ++i) {
  278. BDE peerEntry = BDE::dict();
  279. peerEntry["peerId"] = Util::torrentUrlencode((*i)->getPeerId(),
  280. PEER_ID_LENGTH);
  281. peerEntry["ip"] = (*i)->ipaddr;
  282. peerEntry["port"] = Util::uitos((*i)->port);
  283. peerEntry["bitfield"] = Util::toHex((*i)->getBitfield(),
  284. (*i)->getBitfieldLength());
  285. peerEntry["amChoking"] = (*i)->amChoking()?BDE_TRUE:BDE_FALSE;
  286. peerEntry["peerChoking"] = (*i)->peerChoking()?BDE_TRUE:BDE_FALSE;
  287. TransferStat stat = ps->getTransferStatFor(*i);
  288. peerEntry["downloadSpeed"] = Util::uitos(stat.getDownloadSpeed());
  289. peerEntry["uploadSpeed"] = Util::uitos(stat.getUploadSpeed());
  290. peerEntry["seeder"] = (*i)->isSeeder()?BDE_TRUE:BDE_FALSE;
  291. peers << peerEntry;
  292. }
  293. }
  294. #endif // ENABLE_BITTORRENT
  295. static void gatherProgress
  296. (BDE& entryDict, const SharedHandle<RequestGroup>& group, DownloadEngine* e)
  297. {
  298. gatherProgressCommon(entryDict, group);
  299. #ifdef ENABLE_BITTORRENT
  300. SharedHandle<BtContext> btctx =
  301. dynamic_pointer_cast<BtContext>(group->getDownloadContext());
  302. if(!btctx.isNull()) {
  303. SharedHandle<BtRegistry> btreg = e->getBtRegistry();
  304. gatherProgressBitTorrent(entryDict, btctx, btreg);
  305. }
  306. #endif // ENABLE_BITTORRENT
  307. }
  308. static void gatherStoppedDownload
  309. (BDE& entryDict, const SharedHandle<DownloadResult>& ds)
  310. {
  311. entryDict["gid"] = Util::itos(ds->gid);
  312. if(ds->result == DownloadResult::IN_PROGRESS) {
  313. entryDict["status"] = BDE_REMOVED;
  314. } else if(ds->result == DownloadResult::FINISHED) {
  315. entryDict["status"] = BDE_COMPLETE;
  316. } else {
  317. entryDict["status"] = BDE_ERROR;
  318. }
  319. }
  320. static
  321. SharedHandle<RequestGroup>
  322. findRequestGroup(const SharedHandle<RequestGroupMan>& rgman, int32_t gid)
  323. {
  324. SharedHandle<RequestGroup> group = rgman->findRequestGroup(gid);
  325. if(group.isNull()) {
  326. group = rgman->findReservedGroup(gid);
  327. }
  328. return group;
  329. }
  330. template<typename InputIterator>
  331. static void createFileEntry(BDE& files, InputIterator first, InputIterator last)
  332. {
  333. size_t index = 1;
  334. for(; first != last; ++first, ++index) {
  335. BDE entry = BDE::dict();
  336. entry["index"] = Util::uitos(index);
  337. entry["path"] = (*first)->getPath();
  338. entry["selected"] = (*first)->isRequested()?BDE_TRUE:BDE_FALSE;
  339. entry["length"] = Util::uitos((*first)->getLength());
  340. files << entry;
  341. }
  342. }
  343. BDE GetFilesXmlRpcMethod::process
  344. (const XmlRpcRequest& req, DownloadEngine* e)
  345. {
  346. const BDE& params = req._params;
  347. assert(params.isList());
  348. if(params.empty() || !params[0].isString()) {
  349. throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
  350. }
  351. int32_t gid = Util::parseInt(params[0].s());
  352. BDE files = BDE::list();
  353. SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
  354. if(group.isNull()) {
  355. SharedHandle<DownloadResult> dr =
  356. e->_requestGroupMan->findDownloadResult(gid);
  357. if(dr.isNull()) {
  358. throw DL_ABORT_EX
  359. (StringFormat("No file data is available for GID#%d", gid).str());
  360. } else {
  361. createFileEntry(files, dr->fileEntries.begin(), dr->fileEntries.end());
  362. }
  363. } else {
  364. const std::deque<SharedHandle<FileEntry> >& fileEntries =
  365. group->getDownloadContext()->getFileEntries();
  366. createFileEntry(files, fileEntries.begin(), fileEntries.end());
  367. }
  368. return files;
  369. }
  370. BDE GetUrisXmlRpcMethod::process
  371. (const XmlRpcRequest& req, DownloadEngine* e)
  372. {
  373. const BDE& params = req._params;
  374. assert(params.isList());
  375. if(params.empty() || !params[0].isString()) {
  376. throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
  377. }
  378. int32_t gid = Util::parseInt(params[0].s());
  379. SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
  380. if(group.isNull()) {
  381. throw DL_ABORT_EX
  382. (StringFormat("No URI data is available for GID#%d", gid).str());
  383. }
  384. BDE uriList = BDE::list();
  385. std::deque<std::string> uris;
  386. group->getURIs(uris);
  387. for(std::deque<std::string>::const_iterator i = uris.begin(); i != uris.end();
  388. ++i) {
  389. BDE entry = BDE::dict();
  390. entry["uri"] = *i;
  391. uriList << entry;
  392. }
  393. return uriList;
  394. }
  395. #ifdef ENABLE_BITTORRENT
  396. BDE GetPeersXmlRpcMethod::process
  397. (const XmlRpcRequest& req, DownloadEngine* e)
  398. {
  399. const BDE& params = req._params;
  400. assert(params.isList());
  401. if(params.empty() || !params[0].isString()) {
  402. throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
  403. }
  404. int32_t gid = Util::parseInt(params[0].s());
  405. SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
  406. if(group.isNull()) {
  407. throw DL_ABORT_EX
  408. (StringFormat("No peer data is available for GID#%d", gid).str());
  409. }
  410. BDE peers = BDE::list();
  411. SharedHandle<BtContext> btctx =
  412. dynamic_pointer_cast<BtContext>(group->getDownloadContext());
  413. if(!btctx.isNull()) {
  414. SharedHandle<BtRegistry> btreg = e->getBtRegistry();
  415. SharedHandle<PeerStorage> peerStorage =
  416. btreg->get(btctx->getInfoHashAsString())._peerStorage;
  417. assert(!peerStorage.isNull());
  418. BDE entry = BDE::dict();
  419. gatherPeer(peers, peerStorage);
  420. }
  421. return peers;
  422. }
  423. #endif // ENABLE_BITTORRENT
  424. BDE TellStatusXmlRpcMethod::process
  425. (const XmlRpcRequest& req, DownloadEngine* e)
  426. {
  427. const BDE& params = req._params;
  428. assert(params.isList());
  429. if(params.empty() || !params[0].isString()) {
  430. throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
  431. }
  432. int32_t gid = Util::parseInt(params[0].s());
  433. SharedHandle<RequestGroup> group = e->_requestGroupMan->findRequestGroup(gid);
  434. BDE entryDict = BDE::dict();
  435. if(group.isNull()) {
  436. group = e->_requestGroupMan->findReservedGroup(gid);
  437. if(group.isNull()) {
  438. SharedHandle<DownloadResult> ds =
  439. e->_requestGroupMan->findDownloadResult(gid);
  440. if(ds.isNull()) {
  441. throw DL_ABORT_EX
  442. (StringFormat("No such download for GID#%d", gid).str());
  443. }
  444. gatherStoppedDownload(entryDict, ds);
  445. } else {
  446. entryDict["status"] = BDE_WAITING;
  447. gatherProgress(entryDict, group, e);
  448. }
  449. } else {
  450. entryDict["status"] = BDE_ACTIVE;
  451. gatherProgress(entryDict, group, e);
  452. }
  453. return entryDict;
  454. }
  455. BDE TellActiveXmlRpcMethod::process
  456. (const XmlRpcRequest& req, DownloadEngine* e)
  457. {
  458. BDE list = BDE::list();
  459. const std::deque<SharedHandle<RequestGroup> >& groups =
  460. e->_requestGroupMan->getRequestGroups();
  461. for(std::deque<SharedHandle<RequestGroup> >::const_iterator i =
  462. groups.begin(); i != groups.end(); ++i) {
  463. BDE entryDict = BDE::dict();
  464. entryDict["status"] = BDE_ACTIVE;
  465. gatherProgress(entryDict, *i, e);
  466. list << entryDict;
  467. }
  468. return list;
  469. }
  470. BDE PurgeDownloadResultXmlRpcMethod::process
  471. (const XmlRpcRequest& req, DownloadEngine* e)
  472. {
  473. e->_requestGroupMan->purgeDownloadResult();
  474. return BDE_OK;
  475. }
  476. BDE ChangeOptionXmlRpcMethod::process
  477. (const XmlRpcRequest& req, DownloadEngine* e)
  478. {
  479. const BDE& params = req._params;
  480. assert(params.isList());
  481. if(params.empty() || !params[0].isString()) {
  482. throw DL_ABORT_EX(MSG_GID_NOT_PROVIDED);
  483. }
  484. int32_t gid = Util::parseInt(params[0].s());
  485. SharedHandle<RequestGroup> group = findRequestGroup(e->_requestGroupMan, gid);
  486. if(group.isNull()) {
  487. throw DL_ABORT_EX
  488. (StringFormat("Cannot change option for GID#%d", gid).str());
  489. }
  490. SharedHandle<Option> option(new Option(*group->getOption().get()));
  491. if(params.size() > 1 && params[1].isDict()) {
  492. gatherChangeableOption(option, params[1]);
  493. }
  494. if(option->defined(PREF_MAX_DOWNLOAD_LIMIT)) {
  495. group->setMaxDownloadSpeedLimit(option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT));
  496. }
  497. if(option->defined(PREF_MAX_UPLOAD_LIMIT)) {
  498. group->setMaxUploadSpeedLimit(option->getAsInt(PREF_MAX_UPLOAD_LIMIT));
  499. }
  500. return BDE_OK;
  501. }
  502. BDE ChangeGlobalOptionXmlRpcMethod::process
  503. (const XmlRpcRequest& req, DownloadEngine* e)
  504. {
  505. const BDE& params = req._params;
  506. assert(params.isList());
  507. if(params.empty() || !params[0].isDict()) {
  508. return BDE_OK;
  509. }
  510. SharedHandle<Option> option(new Option(*e->option));
  511. gatherChangeableGlobalOption(option, params[0]);
  512. if(option->defined(PREF_MAX_OVERALL_DOWNLOAD_LIMIT)) {
  513. e->_requestGroupMan->setMaxOverallDownloadSpeedLimit
  514. (option->getAsInt(PREF_MAX_OVERALL_DOWNLOAD_LIMIT));
  515. }
  516. if(option->defined(PREF_MAX_OVERALL_UPLOAD_LIMIT)) {
  517. e->_requestGroupMan->setMaxOverallUploadSpeedLimit
  518. (option->getAsInt(PREF_MAX_OVERALL_UPLOAD_LIMIT));
  519. }
  520. if(option->defined(PREF_MAX_CONCURRENT_DOWNLOADS)) {
  521. e->_requestGroupMan->setMaxSimultaneousDownloads
  522. (option->getAsInt(PREF_MAX_CONCURRENT_DOWNLOADS));
  523. }
  524. return BDE_OK;
  525. }
  526. BDE NoSuchMethodXmlRpcMethod::process
  527. (const XmlRpcRequest& req, DownloadEngine* e)
  528. {
  529. throw DL_ABORT_EX
  530. (StringFormat("No such method: %s", req._methodName.c_str()).str());
  531. }
  532. } // namespace xmlrpc
  533. } // namespace aria2