Remove useless Aria2c error handling functions (#306)

Remove useless Aria2c error handling functions
This commit is contained in:
Matthieu Gautier 2020-01-28 17:36:54 +01:00 committed by GitHub
commit 94c47383a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 10 deletions

View File

@ -97,7 +97,6 @@ class Downloader
size_t getNbDownload() { return m_knownDownloads.size(); } size_t getNbDownload() { return m_knownDownloads.size(); }
std::vector<std::string> getDownloadIds(); std::vector<std::string> getDownloadIds();
const std::string &getAria2LaunchCmd();
private: private:
std::map<std::string, std::unique_ptr<Download>> m_knownDownloads; std::map<std::string, std::unique_ptr<Download>> m_knownDownloads;

View File

@ -78,8 +78,9 @@ Aria2::Aria2():
callCmd.push_back("--max-concurrent-downloads=42"); callCmd.push_back("--max-concurrent-downloads=42");
callCmd.push_back("--rpc-max-request-size=6M"); callCmd.push_back("--rpc-max-request-size=6M");
callCmd.push_back("--file-allocation=none"); callCmd.push_back("--file-allocation=none");
std::string launchCmd;
for (auto &cmd : callCmd) { for (auto &cmd : callCmd) {
m_launchCmd.append(cmd).append(" "); launchCmd.append(cmd).append(" ");
} }
mp_aria = Subprocess::run(callCmd); mp_aria = Subprocess::run(callCmd);
mp_curl = curl_easy_init(); mp_curl = curl_easy_init();
@ -108,7 +109,7 @@ Aria2::Aria2():
} }
if (!watchdog) { if (!watchdog) {
curl_easy_cleanup(mp_curl); curl_easy_cleanup(mp_curl);
throw std::runtime_error("Cannot connect to aria2c rpc"); throw std::runtime_error("Cannot connect to aria2c rpc. Aria2c launch cmd : " + launchCmd);
} }
} }

View File

@ -26,7 +26,6 @@ class Aria2
std::string m_downloadDir; std::string m_downloadDir;
CURL* mp_curl; CURL* mp_curl;
pthread_mutex_t m_lock; pthread_mutex_t m_lock;
std::string m_launchCmd;
std::string doRequest(const MethodCall& methodCall); std::string doRequest(const MethodCall& methodCall);
@ -44,7 +43,6 @@ class Aria2
void pause(const std::string& gid); void pause(const std::string& gid);
void unpause(const std::string& gid); void unpause(const std::string& gid);
void remove(const std::string& gid); void remove(const std::string& gid);
const std::string &getLaunchCmd() { return m_launchCmd; };
}; };
}; //end namespace kiwix }; //end namespace kiwix

View File

@ -163,11 +163,6 @@ std::vector<std::string> Downloader::getDownloadIds() {
return ret; return ret;
} }
const std::string &Downloader::getAria2LaunchCmd()
{
return mp_aria->getLaunchCmd();
}
Download* Downloader::startDownload(const std::string& uri) Download* Downloader::startDownload(const std::string& uri)
{ {
for (auto& p: m_knownDownloads) { for (auto& p: m_knownDownloads) {