diff --git a/rak/error_number.h b/rak/error_number.h index 7f2a4706..d2964b0f 100644 --- a/rak/error_number.h +++ b/rak/error_number.h @@ -56,6 +56,7 @@ public: bool is_closed() const { return m_errno == ECONNRESET || m_errno == ECONNABORTED; } static error_number current() { return errno; } + static void clear_global() { errno = 0; } private: int m_errno; diff --git a/src/core/curl_stack.cc b/src/core/curl_stack.cc index 8200abd4..ef8c625e 100644 --- a/src/core/curl_stack.cc +++ b/src/core/curl_stack.cc @@ -69,7 +69,7 @@ CurlStack::perform() { code = curl_multi_perform((CURLM*)m_handle, &s); if (code > 0) - throw torrent::local_error("Error calling curl_multi_perform"); + throw std::runtime_error("Error calling curl_multi_perform"); if (s != m_size) { // Done with some handles. @@ -82,7 +82,7 @@ CurlStack::perform() { rak::equal(msg->easy_handle, std::mem_fun(&CurlGet::handle))); if (itr == m_getList.end()) - throw torrent::client_error("Could not find CurlGet with the right easy_handle"); + throw std::logic_error("Could not find CurlGet with the right easy_handle"); (*itr)->perform(msg); } while (t); @@ -110,6 +110,9 @@ CurlStack::add_get(CurlGet* get) { m_size++; m_getList.push_back(get); + + // Curl ML suggest we need to do perform after adding a handle. + perform(); } void