- zval **args, **trace_0, *old_trace_0, *trace = NULL;
-
- if ((trace = zend_read_property(ZEND_EXCEPTION_GET_DEFAULT(), from, "trace", lenof("trace"), 0 TSRMLS_CC))) {
- if (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(trace), 0, (void *) &trace_0)) {
- old_trace_0 = *trace_0;
- if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(trace_0), "args", sizeof("args"), (void *) &args)) {
- if ((trace = zend_read_property(ZEND_EXCEPTION_GET_DEFAULT(), to, "trace", lenof("trace"), 0 TSRMLS_CC))) {
- if (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(trace), 0, (void *) &trace_0)) {
- ZVAL_ADDREF(*args);
- add_assoc_zval(*trace_0, "args", *args);
- zend_hash_del(Z_ARRVAL_P(old_trace_0), "args", sizeof("args"));
- }
- }
+ http_request_pool_event *ev = event_data;
+ http_request_pool *pool = ev->pool;
+
+ if (pool->useevents) {
+ CURLMcode rc = CURLE_OK;
+ TSRMLS_FETCH_FROM_CTX(ev->pool->tsrm_ls);
+
+#if HTTP_DEBUG_REQPOOLS
+ {
+ static const char event_strings[][20] = {"NONE","TIMEOUT","READ","TIMEOUT|READ","WRITE","TIMEOUT|WRITE","READ|WRITE","TIMEOUT|READ|WRITE","SIGNAL"};
+ fprintf(stderr, "Event on socket %d (%s) event %p of pool %p\n", socket, event_strings[action], ev, pool);
+ }
+#endif
+
+ /* don't use 'ev' below this loop as it might 've been freed in the socket callback */
+ do {
+#ifdef HAVE_CURL_MULTI_SOCKET_ACTION
+ switch (action & (EV_READ|EV_WRITE)) {
+ case EV_READ:
+ rc = curl_multi_socket_action(pool->ch, socket, CURL_CSELECT_IN, &pool->unfinished);
+ break;
+ case EV_WRITE:
+ rc = curl_multi_socket_action(pool->ch, socket, CURL_CSELECT_OUT, &pool->unfinished);
+ break;
+ case EV_READ|EV_WRITE:
+ rc = curl_multi_socket_action(pool->ch, socket, CURL_CSELECT_IN|CURL_CSELECT_OUT, &pool->unfinished);
+ break;
+ default:
+ http_error_ex(HE_WARNING, HTTP_E_SOCKET, "Unknown event %d", (int) action);
+ return;