void HTTPCURLContext::onTimeout(UV_TIMER_PARAMS(req)) { assert(req->data); auto context = reinterpret_cast<HTTPCURLContext *>(req->data); MBGL_VERIFY_THREAD(context->tid); int running_handles; CURLMcode error = curl_multi_socket_action(context->multi, CURL_SOCKET_TIMEOUT, 0, &running_handles); if (error != CURLM_OK) { throw std::runtime_error(std::string("CURL multi error: ") + curl_multi_strerror(error)); } context->checkMultiInfo(); }
void HTTPCURLContext::perform(uv_poll_t *req, int /* status */, int events) { assert(req->data); auto socket = reinterpret_cast<Socket *>(req->data); auto context = socket->context; MBGL_VERIFY_THREAD(context->tid); int flags = 0; if (events & UV_READABLE) { flags |= CURL_CSELECT_IN; } if (events & UV_WRITABLE) { flags |= CURL_CSELECT_OUT; } int running_handles = 0; curl_multi_socket_action(context->multi, socket->sockfd, flags, &running_handles); context->checkMultiInfo(); }