diff options
author | Max Kellermann <max@duempel.org> | 2014-03-02 00:17:32 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-02 00:17:32 +0100 |
commit | 2bf2f34b1211bfde95ef4ada77147a8b65830084 (patch) | |
tree | a6e639ccd3d07d445968f888e59bab580981ce89 /src/input/plugins/CurlInputPlugin.cxx | |
parent | 7453c26ec4838760dec767b2f99afff9eb537d53 (diff) | |
download | mpd-2bf2f34b1211bfde95ef4ada77147a8b65830084.tar.gz mpd-2bf2f34b1211bfde95ef4ada77147a8b65830084.tar.xz mpd-2bf2f34b1211bfde95ef4ada77147a8b65830084.zip |
InputPlugin: allow init() to soft-fail
Add enum InputResult which is a tri-state. Input plugins may now fail
and just become unavailable.
Diffstat (limited to '')
-rw-r--r-- | src/input/plugins/CurlInputPlugin.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index 3704aa35a..3f496cb96 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -595,7 +595,7 @@ CurlMulti::OnTimeout() * */ -static bool +static InputPlugin::InitResult input_curl_init(const config_param ¶m, Error &error) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); @@ -603,7 +603,7 @@ input_curl_init(const config_param ¶m, Error &error) error.Format(curl_domain, code, "curl_global_init() failed: %s", curl_easy_strerror(code)); - return false; + return InputPlugin::InitResult::UNAVAILABLE; } const auto version_info = curl_version_info(CURLVERSION_FIRST); @@ -634,12 +634,14 @@ input_curl_init(const config_param ¶m, Error &error) CURLM *multi = curl_multi_init(); if (multi == nullptr) { + curl_slist_free_all(http_200_aliases); + curl_global_cleanup(); error.Set(curl_domain, 0, "curl_multi_init() failed"); - return false; + return InputPlugin::InitResult::UNAVAILABLE; } curl_multi = new CurlMulti(io_thread_get(), multi); - return true; + return InputPlugin::InitResult::SUCCESS; } static void |