From 562c9941215d5080452fd8686dba6c408cb8ddda Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 7 Nov 2005 22:15:42 +0000 Subject: [PATCH] - due to the aggressive object deallocation the request object and its curl handle would already have been cleaned up when reaching curl_multi_remove_handle() when there's no additional reference to the request object (i.e. no user space reference to the attached request object); e.g.: $pool = new HttpRequestPool(new HttpRequest('...')) --- http_request_pool_api.c | 18 +++++++++--------- package2.xml | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) 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; diff --git a/package2.xml b/package2.xml index 043d398..5ef731d 100644 --- a/package2.xml +++ b/package2.xml @@ -41,6 +41,8 @@ = 5.1 with SPL is available + Class HttpMessage implements Serializable if PHP >= 5.1 is available + +* Fixed a bug that caused a warning about an invalid curl handle at HttpRequestPool destruction ]]> -- 2.30.2