From: Stefan Eissing Date: Sat, 25 Feb 2017 12:15:20 +0000 (+0000) Subject: On the trunk: X-Git-Tag: 2.5.0-alpha~603 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e570ce5bdb571db9b1a0d433ed8f9d54f9da4486;p=thirdparty%2Fapache%2Fhttpd.git On the trunk: mod_http2: installing own mutex'ed allocator on main session pool. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1784372 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index d5ac7662ab9..99a9c094d74 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -27,6 +27,8 @@ #include #include +#include + #include "h2_private.h" #include "h2.h" #include "h2_bucket_eos.h" @@ -711,16 +713,31 @@ static h2_session *h2_session_create_int(conn_rec *c, { nghttp2_session_callbacks *callbacks = NULL; nghttp2_option *options = NULL; + apr_allocator_t *allocator; + apr_thread_mutex_t *mutex; uint32_t n; - apr_pool_t *pool = NULL; - apr_status_t status = apr_pool_create(&pool, c->pool); h2_session *session; + + apr_status_t status = apr_allocator_create(&allocator); if (status != APR_SUCCESS) { return NULL; } + apr_allocator_max_free_set(allocator, ap_max_mem_free); + apr_pool_create_ex(&pool, c->pool, NULL, allocator); + if (!pool) { + apr_allocator_destroy(allocator); + return NULL; + } apr_pool_tag(pool, "h2_session"); - + apr_allocator_owner_set(allocator, pool); + status = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool); + if (status != APR_SUCCESS) { + apr_pool_destroy(pool); + return NULL; + } + apr_allocator_mutex_set(allocator, mutex); + /* get h2_session a lifetime beyond its pool and everything * connected to it. */ session = apr_pcalloc(pool, sizeof(h2_session));