refactored client options
[m6w6/ext-http] / php_http_curl_client_pool.c
index 6ae1da658ae99886433b3fb347fa106ee1fd749a..5e51a286bd64554528cc7ef1f60d1b1a428bc75c 100644 (file)
@@ -556,16 +556,25 @@ PHP_MINIT_FUNCTION(http_curl_client_pool)
        return SUCCESS;
 }
 
+#if PHP_HTTP_HAVE_EVENT
 PHP_RINIT_FUNCTION(http_curl_client_pool)
 {
-#if PHP_HTTP_HAVE_EVENT
        if (!PHP_HTTP_G->curl.event_base && !(PHP_HTTP_G->curl.event_base = event_base_new())) {
                return FAILURE;
        }
+       return SUCCESS;
+}
 #endif
 
+#if PHP_HTTP_HAVE_EVENT
+PHP_RSHUTDOWN_FUNCTION(http_curl_client_pool)
+{
+       if (PHP_HTTP_G->curl.event_base) {
+               event_base_free(PHP_HTTP_G->curl.event_base);
+       }
        return SUCCESS;
 }
+#endif
 
 #endif /* PHP_HTTP_HAVE_CURL */