diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2014-06-18 20:31:08 -0700 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2014-06-18 20:31:08 -0700 |
commit | f889bced4e1b6518904a7f8458d646489d497d0e (patch) | |
tree | 2dae19069a211cbee778502453d20ef8a3b5f7a1 /src | |
parent | e3c2cf74256daf8131f39631d349a9fa9cacacc2 (diff) |
Fixing mixup with the curl event bitmasks, and fixing curl's ulock code.
Diffstat (limited to 'src')
-rw-r--r-- | src/TaskMan.cc | 23 |
1 files changed, 17 insertions, 6 deletions
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 <Windows.h> +#endif + +#undef ERROR #include "Async.h" #include "TaskMan.h" @@ -6,10 +11,6 @@ #include "Local.h" #include "CurlTask.h" -#ifdef _MSC_VER -#include <Windows.h> -#endif - #include <curl/curl.h> 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); } |