X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=http_request_pool_api.c;h=c3820c41ed305224063d91ce894855429e2c81ff;hb=562c9941215d5080452fd8686dba6c408cb8ddda;hp=188bb9d326aea647f94dd678ea8463ef33c8e973;hpb=d7b22bfb4a76664b4dcffa8644e19aba2e5338ab;p=m6w6%2Fext-http diff --git a/http_request_pool_api.c b/http_request_pool_api.c index 188bb9d..c3820c4 100644 --- a/http_request_pool_api.c +++ b/http_request_pool_api.c @@ -28,7 +28,7 @@ #include "php_http_requestpool_object.h" #ifndef HTTP_DEBUG_REQPOOLS -# define HTTP_DEBUG_REQPOOLS 0 +# define HTTP_DEBUG_REQPOOLS 1 #endif ZEND_EXTERN_MODULE_GLOBALS(http); @@ -136,18 +136,18 @@ PHP_HTTP_API STATUS _http_request_pool_detach(http_request_pool *pool, zval *req } else { CURLMcode code; - req->pool = NULL; - zend_llist_del_element(&pool->handles, request, http_request_pool_compare_handles); - zend_llist_del_element(&pool->finished, request, http_request_pool_compare_handles); - + if (CURLM_OK == (code = curl_multi_remove_handle(pool->ch, req->ch))) { + req->pool = NULL; + zend_llist_del_element(&pool->handles, request, http_request_pool_compare_handles); + zend_llist_del_element(&pool->finished, request, http_request_pool_compare_handles); + #if HTTP_DEBUG_REQPOOLS - fprintf(stderr, "> %d HttpRequests remaining in pool %p\n", zend_llist_count(&pool->handles), pool); + fprintf(stderr, "> %d HttpRequests remaining in pool %p\n", zend_llist_count(&pool->handles), pool); #endif - if (CURLM_OK != (code = curl_multi_remove_handle(pool->ch, req->ch))) { - http_error_ex(HE_WARNING, HTTP_E_REQUEST_POOL, "Could not detach HttpRequest object from the HttpRequestPool: %s", curl_multi_strerror(code)); - } else { return SUCCESS; + } else { + http_error_ex(HE_WARNING, HTTP_E_REQUEST_POOL, "Could not detach HttpRequest object from the HttpRequestPool: %s", curl_multi_strerror(code)); } } return FAILURE;