- php_http_client_t *context = event_data;
- php_http_client_curl_t *curl = context->ctx;
-
-#if DBG_EVENTS
- fprintf(stderr, "T");
-#endif
- if (curl->useevents) {
- CURLMcode rc;
-
- /* ignore and use -1,0 on timeout */
- (void) socket;
- (void) action;
-
- while (CURLM_CALL_MULTI_PERFORM == (rc = curl_multi_socket_action(curl->handle->multi, CURL_SOCKET_TIMEOUT, 0, &curl->unfinished)));
-
- if (CURLM_OK != rc) {
- php_error_docref(NULL, E_WARNING, "%s", curl_multi_strerror(rc));
- }
-
- php_http_curlm_responsehandler(context);
- }
-}
-
-static void php_http_curlm_event_callback(int socket, short action, void *event_data)
-{
- php_http_client_t *context = event_data;
- php_http_client_curl_t *curl = context->ctx;
-
-#if DBG_EVENTS
- fprintf(stderr, "E");
-#endif
- if (curl->useevents) {
- CURLMcode rc = CURLM_OK;
-
- while (CURLM_CALL_MULTI_PERFORM == (rc = curl_multi_socket_action(curl->handle->multi, socket, etoca(action), &curl->unfinished)));
-
- if (CURLM_OK != rc) {
- php_error_docref(NULL, E_WARNING, "%s", curl_multi_strerror(rc));
- }
-
- php_http_curlm_responsehandler(context);
-
- /* remove timeout if there are no transfers left */
- if (!curl->unfinished && event_initialized(curl->timeout) && event_pending(curl->timeout, EV_TIMEOUT, NULL)) {
- event_del(curl->timeout);
- }
- }
-}
-
-static int php_http_curlm_socket_callback(CURL *easy, curl_socket_t sock, int action, void *socket_data, void *assign_data)
-{
- php_http_client_t *context = socket_data;
- php_http_client_curl_t *curl = context->ctx;