summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/TaskMan.cc23
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);
}