return c;
}
-apr_status_t h2_conn_setup(h2_task *task, struct h2_worker *worker)
+apr_status_t h2_conn_setup(h2_task *task, apr_bucket_alloc_t *bucket_alloc,
+ apr_thread_t *thread, apr_socket_t *socket)
{
conn_rec *master = task->mplx->c;
* pools.
*/
task->c->pool = task->pool;
- task->c->bucket_alloc = h2_worker_get_bucket_alloc(worker);
- task->c->current_thread = h2_worker_get_thread(worker);
+ task->c->current_thread = thread;
+ task->c->bucket_alloc = bucket_alloc;
task->c->conn_config = ap_create_conn_config(task->pool);
task->c->notes = apr_table_make(task->pool, 5);
/* In order to do this in 2.4.x, we need to add a member to conn_rec */
task->c->master = master;
- ap_set_module_config(task->c->conn_config, &core_module,
- h2_worker_get_socket(worker));
+ ap_set_module_config(task->c->conn_config, &core_module, socket);
/* This works for mpm_worker so far. Other mpm modules have
* different needs, unfortunately. The most interesting one
#define __mod_h2__h2_conn__
struct h2_task;
-struct h2_worker;
/**
* Process the connection that is now starting the HTTP/2
conn_rec *h2_conn_create(conn_rec *master, apr_pool_t *stream_pool);
-apr_status_t h2_conn_setup(struct h2_task *task, struct h2_worker *worker);
+apr_status_t h2_conn_setup(struct h2_task *task, apr_bucket_alloc_t *bucket_alloc,
+ apr_thread_t *thread, apr_socket_t *socket);
#endif /* defined(__mod_h2__h2_conn__) */
m->lock = NULL;
}
+ if (m->spare_pool) {
+ apr_pool_destroy(m->spare_pool);
+ m->spare_pool = NULL;
+ }
if (m->pool) {
apr_pool_destroy(m->pool);
}
nghttp2_session_del(session->ngh2);
session->ngh2 = NULL;
}
+ if (session->spare) {
+ apr_pool_destroy(session->spare);
+ session->spare = NULL;
+ }
+ if (session->pool) {
+ apr_pool_destroy(session->pool);
+ }
}
void h2_session_cleanup(h2_session *session)
{
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c,
+ "session(%ld): cleanup and destroy", session->id);
h2_session_destroy(session);
- if (session->pool) {
- apr_pool_destroy(session->pool);
- }
}
static apr_status_t h2_session_abort_int(h2_session *session, int reason)
AP_DEBUG_ASSERT(task);
task->serialize_headers = h2_config_geti(cfg, H2_CONF_SER_HEADERS);
-
- /* 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, h2_worker_get_pool(worker));
- /* Link the task to the worker which provides useful things such
- * as mutex, a socket etc. */
- task->io = h2_worker_get_cond(worker);
-
- status = h2_conn_setup(task, worker);
+ status = h2_worker_setup_task(worker, task);
/* save in connection that this one is a pseudo connection, prevents
* other hooks from messing with it. */
apr_thread_cond_signal(task->io);
}
- if (task->pool) {
- apr_pool_destroy(task->pool);
- task->pool = NULL;
- }
+ h2_worker_release_task(worker, task);
h2_mplx_task_done(task->mplx, task->stream_id);
#include <http_log.h>
#include "h2_private.h"
+#include "h2_conn.h"
#include "h2_mplx.h"
#include "h2_task.h"
#include "h2_worker.h"
if (worker->task) {
h2_task_do(worker->task, worker);
worker->task = NULL;
- apr_thread_cond_signal(h2_worker_get_cond(worker));
+ apr_thread_cond_signal(worker->io);
}
}
w->id = id;
w->pool = pool;
- w->bucket_alloc = apr_bucket_alloc_create(pool);
w->get_next = get_next;
w->worker_done = worker_done;
return worker->aborted;
}
-apr_thread_t *h2_worker_get_thread(h2_worker *worker)
-{
- return worker->thread;
+apr_status_t h2_worker_setup_task(h2_worker *worker, h2_task *task) {
+ apr_status_t status;
+
+ /* 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);
+
+ /* Link the task to the worker which provides useful things such
+ * as mutex, a socket etc. */
+ task->io = worker->io;
+
+ status = h2_conn_setup(task, apr_bucket_alloc_create(task->pool),
+ worker->thread, worker->socket);
+
+ return status;
}
-apr_thread_cond_t *h2_worker_get_cond(h2_worker *worker)
+void h2_worker_release_task(h2_worker *worker, struct h2_task *task)
{
- return worker->io;
+ task->io = NULL;
+
+ if (task->pool) {
+ apr_pool_destroy(task->pool);
+ task->pool = NULL;
+ }
}
apr_socket_t *h2_worker_get_socket(h2_worker *worker)
return worker->socket;
}
-apr_pool_t *h2_worker_get_pool(h2_worker *worker)
-{
- return worker->pool;
-}
-
-apr_bucket_alloc_t *h2_worker_get_bucket_alloc(h2_worker *worker)
-{
- return worker->bucket_alloc;
-}
int id;
apr_thread_t *thread;
apr_pool_t *pool;
- apr_bucket_alloc_t *bucket_alloc;
struct apr_thread_cond_t *io;
apr_socket_t *socket;
int h2_worker_is_aborted(h2_worker *worker);
-apr_pool_t *h2_worker_get_pool(h2_worker *worker);
-
-apr_bucket_alloc_t *h2_worker_get_bucket_alloc(h2_worker *worker);
+apr_status_t h2_worker_setup_task(h2_worker *worker, struct h2_task *task);
+void h2_worker_release_task(h2_worker *worker, struct h2_task *task);
apr_socket_t *h2_worker_get_socket(h2_worker *worker);
-apr_thread_t *h2_worker_get_thread(h2_worker *worker);
-
-struct apr_thread_cond_t *h2_worker_get_cond(h2_worker *worker);
-
#endif /* defined(__mod_h2__h2_worker__) */