lib/curl/Global: decouple from the IOThread library
This commit is contained in:
parent
3854211694
commit
add953fb6e
@ -30,8 +30,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "Global.hxx"
|
#include "Global.hxx"
|
||||||
#include "Request.hxx"
|
#include "Request.hxx"
|
||||||
#include "IOThread.hxx"
|
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
#include "event/Loop.hxx"
|
||||||
#include "event/SocketMonitor.hxx"
|
#include "event/SocketMonitor.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
@ -112,7 +112,7 @@ CurlSocket::SocketFunction(gcc_unused CURL *easy,
|
|||||||
auto &global = *(CurlGlobal *)userp;
|
auto &global = *(CurlGlobal *)userp;
|
||||||
CurlSocket *cs = (CurlSocket *)socketp;
|
CurlSocket *cs = (CurlSocket *)socketp;
|
||||||
|
|
||||||
assert(io_thread_inside());
|
assert(global.GetEventLoop().IsInside());
|
||||||
|
|
||||||
if (action == CURL_POLL_REMOVE) {
|
if (action == CURL_POLL_REMOVE) {
|
||||||
delete cs;
|
delete cs;
|
||||||
@ -120,7 +120,7 @@ CurlSocket::SocketFunction(gcc_unused CURL *easy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cs == nullptr) {
|
if (cs == nullptr) {
|
||||||
cs = new CurlSocket(global, io_thread_get(), s);
|
cs = new CurlSocket(global, global.GetEventLoop(), s);
|
||||||
global.Assign(s, *cs);
|
global.Assign(s, *cs);
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_EPOLL
|
#ifdef USE_EPOLL
|
||||||
@ -145,7 +145,7 @@ CurlSocket::SocketFunction(gcc_unused CURL *easy,
|
|||||||
bool
|
bool
|
||||||
CurlSocket::OnSocketReady(unsigned flags)
|
CurlSocket::OnSocketReady(unsigned flags)
|
||||||
{
|
{
|
||||||
assert(io_thread_inside());
|
assert(GetEventLoop().IsInside());
|
||||||
|
|
||||||
global.SocketAction(Get(), FlagsToCurlCSelect(flags));
|
global.SocketAction(Get(), FlagsToCurlCSelect(flags));
|
||||||
return true;
|
return true;
|
||||||
@ -159,7 +159,7 @@ CurlSocket::OnSocketReady(unsigned flags)
|
|||||||
void
|
void
|
||||||
CurlGlobal::Add(CURL *easy, CurlRequest &request)
|
CurlGlobal::Add(CURL *easy, CurlRequest &request)
|
||||||
{
|
{
|
||||||
assert(io_thread_inside());
|
assert(GetEventLoop().IsInside());
|
||||||
assert(easy != nullptr);
|
assert(easy != nullptr);
|
||||||
|
|
||||||
curl_easy_setopt(easy, CURLOPT_PRIVATE, &request);
|
curl_easy_setopt(easy, CURLOPT_PRIVATE, &request);
|
||||||
@ -175,7 +175,7 @@ CurlGlobal::Add(CURL *easy, CurlRequest &request)
|
|||||||
void
|
void
|
||||||
CurlGlobal::Remove(CURL *easy)
|
CurlGlobal::Remove(CURL *easy)
|
||||||
{
|
{
|
||||||
assert(io_thread_inside());
|
assert(GetEventLoop().IsInside());
|
||||||
assert(easy != nullptr);
|
assert(easy != nullptr);
|
||||||
|
|
||||||
curl_multi_remove_handle(multi.Get(), easy);
|
curl_multi_remove_handle(multi.Get(), easy);
|
||||||
@ -202,7 +202,7 @@ ToRequest(CURL *easy)
|
|||||||
inline void
|
inline void
|
||||||
CurlGlobal::ReadInfo()
|
CurlGlobal::ReadInfo()
|
||||||
{
|
{
|
||||||
assert(io_thread_inside());
|
assert(GetEventLoop().IsInside());
|
||||||
|
|
||||||
CURLMsg *msg;
|
CURLMsg *msg;
|
||||||
int msgs_in_queue;
|
int msgs_in_queue;
|
||||||
|
Loading…
Reference in New Issue
Block a user