X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_request_pool_api.h;h=79a3e4ef946111cb1ec3a7a98a0ca5f4e94b9e12;hp=e9ea75cb8eafe00b90cda3b87180b7cc10ca5dd4;hb=5773d11d8c9c28fb8b0e3389258f548fc4717892;hpb=e83a7438dc70ed96630887246a1d3aefcf155b1c diff --git a/php_http_request_pool_api.h b/php_http_request_pool_api.h index e9ea75c..79a3e4e 100644 --- a/php_http_request_pool_api.h +++ b/php_http_request_pool_api.h @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2005, Michael Wallner | + | Copyright (c) 2004-2006, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -16,28 +16,39 @@ #define PHP_HTTP_REQUEST_POOL_API_H #ifdef HTTP_HAVE_CURL -#include "php_http_std_defs.h" -#include "php_http_request_api.h" -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#endif - -#include - -typedef struct { +typedef struct _http_request_pool_t { 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);