projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
fix fragile tests depending on timezone
[m6w6/ext-http]
/
php_http_curl_client_pool.c
diff --git
a/php_http_curl_client_pool.c
b/php_http_curl_client_pool.c
index 6ae1da658ae99886433b3fb347fa106ee1fd749a..2fc391e58f6be879bb1f1d0cf4fab53e36cac1bd 100644
(file)
--- a/
php_http_curl_client_pool.c
+++ b/
php_http_curl_client_pool.c
@@
-37,7
+37,7
@@
typedef struct php_http_curl_client_pool {
#endif
} php_http_curl_client_pool_t;
#endif
} php_http_curl_client_pool_t;
-static void *php_http_curlm_ctor(void *opaque TSRMLS_DC)
+static void *php_http_curlm_ctor(void *opaque
, void *init_arg
TSRMLS_DC)
{
return curl_multi_init();
}
{
return curl_multi_init();
}
@@
-62,7
+62,7
@@
static void php_http_curl_client_pool_responsehandler(php_http_client_pool_t *po
zval **request;
if (CURLE_OK != msg->data.result) {
zval **request;
if (CURLE_OK != msg->data.result) {
- php_http_curl_client_storage_t *st = get_storage(msg->easy_handle);
+ php_http_curl_client_storage_t *st =
php_http_curl_client_
get_storage(msg->easy_handle);
php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT, "%s; %s (%s)", curl_easy_strerror(msg->data.result), STR_PTR(st->errorbuffer), STR_PTR(st->url));
}
php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT, "%s; %s (%s)", curl_easy_strerror(msg->data.result), STR_PTR(st->errorbuffer), STR_PTR(st->url));
}
@@
-246,7
+246,7
@@
static php_http_client_pool_t *php_http_curl_client_pool_init(php_http_client_po
php_http_curl_client_pool_t *curl;
TSRMLS_FETCH_FROM_CTX(h->ts);
php_http_curl_client_pool_t *curl;
TSRMLS_FETCH_FROM_CTX(h->ts);
- if (!handle && !(handle = php_
http_resource_factory_handle_ctor(h->rf
TSRMLS_CC))) {
+ if (!handle && !(handle = php_
resource_factory_handle_ctor(h->rf, NULL
TSRMLS_CC))) {
php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT_POOL, "could not initialize curl pool handle");
return NULL;
}
php_http_error(HE_WARNING, PHP_HTTP_E_CLIENT_POOL, "could not initialize curl pool handle");
return NULL;
}
@@
-273,7
+273,7
@@
static void php_http_curl_client_pool_dtor(php_http_client_pool_t *h)
curl->unfinished = 0;
php_http_client_pool_reset(h);
curl->unfinished = 0;
php_http_client_pool_reset(h);
- php_
http_
resource_factory_handle_dtor(h->rf, curl->handle TSRMLS_CC);
+ php_resource_factory_handle_dtor(h->rf, curl->handle TSRMLS_CC);
efree(curl);
h->ctx = NULL;
efree(curl);
h->ctx = NULL;
@@
-471,7
+471,7
@@
static STATUS php_http_curl_client_pool_setopt(php_http_client_pool_t *h, php_ht
return SUCCESS;
}
return SUCCESS;
}
-static php_
http_
resource_factory_ops_t php_http_curlm_resource_factory_ops = {
+static php_resource_factory_ops_t php_http_curlm_resource_factory_ops = {
php_http_curlm_ctor,
NULL,
php_http_curlm_dtor
php_http_curlm_ctor,
NULL,
php_http_curlm_dtor
@@
-546,7
+546,7
@@
zend_object_value php_http_curl_client_pool_object_new_ex(zend_class_entry *ce,
PHP_MINIT_FUNCTION(http_curl_client_pool)
{
PHP_MINIT_FUNCTION(http_curl_client_pool)
{
- if (SUCCESS != php_
http_persistent_handle_provide(ZEND_STRL("http_client_pool.curl"), &php_http_curlm_resource_factory_ops, NULL, NULL
)) {
+ if (SUCCESS != php_
persistent_handle_provide(ZEND_STRL("http_client_pool.curl"), &php_http_curlm_resource_factory_ops, NULL, NULL TSRMLS_CC
)) {
return FAILURE;
}
return FAILURE;
}
@@
-556,16
+556,26
@@
PHP_MINIT_FUNCTION(http_curl_client_pool)
return SUCCESS;
}
return SUCCESS;
}
+#if PHP_HTTP_HAVE_EVENT
PHP_RINIT_FUNCTION(http_curl_client_pool)
{
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;
}
if (!PHP_HTTP_G->curl.event_base && !(PHP_HTTP_G->curl.event_base = event_base_new())) {
return FAILURE;
}
+ return SUCCESS;
+}
#endif
#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);
+ PHP_HTTP_G->curl.event_base = NULL;
+ }
return SUCCESS;
}
return SUCCESS;
}
+#endif
#endif /* PHP_HTTP_HAVE_CURL */
#endif /* PHP_HTTP_HAVE_CURL */