diff options
Diffstat (limited to 'modules/http2/h2_worker.c')
-rw-r--r-- | modules/http2/h2_worker.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/modules/http2/h2_worker.c b/modules/http2/h2_worker.c index 0100421371..b11e8549ff 100644 --- a/modules/http2/h2_worker.c +++ b/modules/http2/h2_worker.c @@ -24,6 +24,7 @@ #include "h2_private.h" #include "h2_conn.h" #include "h2_mplx.h" +#include "h2_request.h" #include "h2_task.h" #include "h2_worker.h" @@ -123,8 +124,9 @@ h2_worker *h2_worker_create(int id, return NULL; } - apr_pool_pre_cleanup_register(pool, w, cleanup_join_thread); - apr_thread_create(&w->thread, attr, execute, w, pool); + apr_pool_pre_cleanup_register(w->pool, w, cleanup_join_thread); + apr_thread_create(&w->thread, attr, execute, w, w->pool); + apr_pool_create(&w->task_pool, w->pool); } return w; } @@ -157,18 +159,26 @@ int h2_worker_is_aborted(h2_worker *worker) return worker->aborted; } -apr_status_t h2_worker_setup_task(h2_worker *worker, h2_task *task) { - apr_status_t status; +h2_task *h2_worker_create_task(h2_worker *worker, h2_mplx *m, + const h2_request *req, int eos) +{ + h2_task *task; /* Create a subpool from the worker one to be used for all things * with life-time of this task execution. */ - apr_pool_create(&task->pool, worker->pool); - + task = h2_task_create(m->id, req, worker->task_pool, m, eos); /* Link the task to the worker which provides useful things such * as mutex, a socket etc. */ task->io = worker->io; + return task; +} + +apr_status_t h2_worker_setup_task(h2_worker *worker, h2_task *task) { + apr_status_t status; + + status = h2_conn_setup(task, apr_bucket_alloc_create(task->pool), worker->thread, worker->socket); @@ -178,11 +188,8 @@ apr_status_t h2_worker_setup_task(h2_worker *worker, h2_task *task) { void h2_worker_release_task(h2_worker *worker, struct h2_task *task) { task->io = NULL; - - if (task->pool) { - apr_pool_destroy(task->pool); - task->pool = NULL; - } + task->pool = NULL; + apr_pool_clear(worker->task_pool); } apr_socket_t *h2_worker_get_socket(h2_worker *worker) |