lib/curl/Global: remove CURL* parameter from Add() and Remove()
This commit is contained in:
parent
0c8ff56a15
commit
2934fc2507
@ -155,14 +155,11 @@ CurlSocket::OnSocketReady(unsigned flags) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CurlGlobal::Add(CURL *easy, CurlRequest &request)
|
CurlGlobal::Add(CurlRequest &r)
|
||||||
{
|
{
|
||||||
assert(GetEventLoop().IsInside());
|
assert(GetEventLoop().IsInside());
|
||||||
assert(easy != nullptr);
|
|
||||||
|
|
||||||
curl_easy_setopt(easy, CURLOPT_PRIVATE, &request);
|
CURLMcode mcode = curl_multi_add_handle(multi.Get(), r.Get());
|
||||||
|
|
||||||
CURLMcode mcode = curl_multi_add_handle(multi.Get(), easy);
|
|
||||||
if (mcode != CURLM_OK)
|
if (mcode != CURLM_OK)
|
||||||
throw FormatRuntimeError("curl_multi_add_handle() failed: %s",
|
throw FormatRuntimeError("curl_multi_add_handle() failed: %s",
|
||||||
curl_multi_strerror(mcode));
|
curl_multi_strerror(mcode));
|
||||||
@ -171,13 +168,11 @@ CurlGlobal::Add(CURL *easy, CurlRequest &request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CurlGlobal::Remove(CURL *easy) noexcept
|
CurlGlobal::Remove(CurlRequest &r) noexcept
|
||||||
{
|
{
|
||||||
assert(GetEventLoop().IsInside());
|
assert(GetEventLoop().IsInside());
|
||||||
assert(easy != nullptr);
|
|
||||||
|
|
||||||
curl_multi_remove_handle(multi.Get(), easy);
|
|
||||||
|
|
||||||
|
curl_multi_remove_handle(multi.Get(), r.Get());
|
||||||
InvalidateSockets();
|
InvalidateSockets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ public:
|
|||||||
return timeout_event.GetEventLoop();
|
return timeout_event.GetEventLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Add(CURL *easy, CurlRequest &request);
|
void Add(CurlRequest &r);
|
||||||
void Remove(CURL *easy) noexcept;
|
void Remove(CurlRequest &r) noexcept;
|
||||||
|
|
||||||
void Assign(curl_socket_t fd, CurlSocket &cs) noexcept {
|
void Assign(curl_socket_t fd, CurlSocket &cs) noexcept {
|
||||||
curl_multi_assign(multi.Get(), fd, &cs);
|
curl_multi_assign(multi.Get(), fd, &cs);
|
||||||
|
@ -75,7 +75,7 @@ CurlRequest::Start()
|
|||||||
{
|
{
|
||||||
assert(!registered);
|
assert(!registered);
|
||||||
|
|
||||||
global.Add(easy.Get(), *this);
|
global.Add(*this);
|
||||||
registered = true;
|
registered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ CurlRequest::Stop() noexcept
|
|||||||
if (!registered)
|
if (!registered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
global.Remove(easy.Get());
|
global.Remove(*this);
|
||||||
registered = false;
|
registered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user