X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_request_pool_api.h;h=78dbdb2f01a948835082e6d61ad7f28f3b34caac;hb=8fa713be4960d51958523429ee0e7dfca6d017fb;hp=d1ab0b3d1ce4b26087ebc1fd9a49bd6c75f09a88;hpb=edc84b40eb2c5be04492fa98fec5833a030782eb;p=m6w6%2Fext-http diff --git a/php_http_request_pool_api.h b/php_http_request_pool_api.h index d1ab0b3..78dbdb2 100644 --- a/php_http_request_pool_api.h +++ b/php_http_request_pool_api.h @@ -20,14 +20,35 @@ typedef struct { CURLM *ch; zend_llist finished; zend_llist handles; - zend_llist bodies; int unfinished; } http_request_pool; #define http_request_pool_responsehandler _http_request_pool_responsehandler extern void _http_request_pool_responsehandler(zval **req, CURL *ch TSRMLS_DC); -#define http_request_pool_requesthandler(r, b) _http_request_pool_requesthandler((r), (b) TSRMLS_CC) -extern STATUS _http_request_pool_requesthandler(zval *request, http_request_body *body TSRMLS_DC); + +#define http_request_pool_try \ + { \ + zval *old_exception = EG(exception); \ + EG(exception) = NULL; +#define http_request_pool_catch() \ + if (EG(exception)) { \ + http_request_pool_wrap_exception(old_exception, EG(exception)); \ + } else { \ + EG(exception) = old_exception; \ + } \ + } +#define http_request_pool_final() \ + if (EG(exception)) { \ + zval *exception; \ + http_request_pool_wrap_exception(NULL, EG(exception)); \ + exception = EG(exception); \ + EG(exception) = NULL; \ + zend_throw_exception_object(exception TSRMLS_CC); \ + } + +#define http_request_pool_wrap_exception(o, n) _http_request_pool_wrap_exception((o), (n) TSRMLS_CC) +extern void _http_request_pool_wrap_exception(zval *old_exception, zval *new_exception TSRMLS_DC); + #define http_request_pool_init(p) _http_request_pool_init((p) TSRMLS_CC) PHP_HTTP_API http_request_pool *_http_request_pool_init(http_request_pool *pool TSRMLS_DC);