From f889bced4e1b6518904a7f8458d646489d497d0e Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 18 Jun 2014 20:31:08 -0700 Subject: Fixing mixup with the curl event bitmasks, and fixing curl's ulock code. --- src/TaskMan.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/TaskMan.cc b/src/TaskMan.cc index ae3757c..1562c4c 100644 --- a/src/TaskMan.cc +++ b/src/TaskMan.cc @@ -1,3 +1,8 @@ +#ifdef _MSC_VER +#include +#endif + +#undef ERROR #include "Async.h" #include "TaskMan.h" @@ -6,10 +11,6 @@ #include "Local.h" #include "CurlTask.h" -#ifdef _MSC_VER -#include -#endif - #include static Balau::AsyncManager s_async; @@ -60,6 +61,14 @@ class CurlSharedManager : public Balau::AtStart, Balau::AtExit { } static void unlock_function(CURL *handle, curl_lock_data data, void * userptr) { SharedLocks * locks = (SharedLocks *) userptr; + Balau::RWLock * lock = NULL; + switch (data) { + case CURL_LOCK_DATA_COOKIE: lock = &locks->cookie; break; + case CURL_LOCK_DATA_DNS: lock = &locks->dns; break; + case CURL_LOCK_DATA_SSL_SESSION: lock = &locks->ssl_session; break; + default: Failure("Unknown lock"); + } + lock->leave(); } void doStart() { static SharedLocks locks; @@ -281,9 +290,11 @@ int Balau::TaskMan::curlSocketCallback(CURL * easy, curl_socket_t s, int what, v void Balau::TaskMan::curlSocketEventCallback(ev::io & w, int revents) { int bitmask = 0; if (revents & ev::READ) - bitmask |= CURL_POLL_IN; + bitmask |= CURL_CSELECT_IN; if (revents & ev::WRITE) - bitmask |= CURL_POLL_OUT; + bitmask |= CURL_CSELECT_OUT; + if (revents & ev::ERROR) + bitmask |= CURL_CSELECT_ERR; curl_multi_socket_action(m_curlMulti, w.fd, bitmask, &m_curlStillRunning); } -- cgit v1.2.3