1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Follow up to r1879449: yet better MPM poll callback API.

Let pass a const pfds to the MPM, for it to make a copy on the given pool
as needed.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879451 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2020-07-02 15:49:53 +00:00
parent ec2c547006
commit c9472d3fc9
7 changed files with 41 additions and 65 deletions

View File

@@ -29,7 +29,6 @@ typedef struct ws_baton_t {
request_rec *r;
proxy_conn_rec *backend;
proxy_tunnel_rec *tunnel;
apr_array_header_t *pfds;
apr_pool_t *async_pool;
const char *scheme;
} ws_baton_t;
@@ -96,15 +95,8 @@ static void proxy_wstunnel_callback(void *b)
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, baton->r,
"proxy_wstunnel_callback suspend");
/* Update only reqevents of the MPM's pfds with our tunnel's,
* the rest didn't change.
*/
APR_ARRAY_IDX(baton->pfds, 0, apr_pollfd_t).reqevents =
APR_ARRAY_IDX(baton->tunnel->pfds, 0, apr_pollfd_t).reqevents;
APR_ARRAY_IDX(baton->pfds, 1, apr_pollfd_t).reqevents =
APR_ARRAY_IDX(baton->tunnel->pfds, 1, apr_pollfd_t).reqevents;
ap_mpm_register_poll_callback_timeout(baton->async_pool, baton->pfds,
ap_mpm_register_poll_callback_timeout(baton->async_pool,
baton->tunnel->pfds,
proxy_wstunnel_callback,
proxy_wstunnel_cancel_callback,
baton, dconf->idle_timeout);
@@ -275,18 +267,15 @@ static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r,
tunnel->timeout = dconf->async_delay;
status = proxy_wstunnel_pump(baton, 1);
if (status == SUSPENDED) {
/* Create the MPM's (baton->)pfds off of our tunnel's, and
* the subpool used by the MPM to alloc its own temporary
* data, which we want to clear on the next round (above)
* to avoid leaks.
/* Create the subpool used by the MPM to alloc its own
* temporary data, which we want to clear on the next
* round (above) to avoid leaks.
*/
baton->pfds = apr_array_copy(baton->r->pool, baton->tunnel->pfds);
APR_ARRAY_IDX(baton->pfds, 0, apr_pollfd_t).client_data = NULL;
APR_ARRAY_IDX(baton->pfds, 1, apr_pollfd_t).client_data = NULL;
apr_pool_create(&baton->async_pool, baton->r->pool);
rv = ap_mpm_register_poll_callback_timeout(
baton->async_pool, baton->pfds,
baton->async_pool,
baton->tunnel->pfds,
proxy_wstunnel_callback,
proxy_wstunnel_cancel_callback,
baton,