From: Stefan Eissing Date: Tue, 14 Feb 2017 12:54:22 +0000 (+0000) Subject: On the trunk: X-Git-Tag: 2.5.0-alpha~662 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c8a1483334d7b34e83e3ca4af4fa7e51466ea41;p=apache On the trunk: mod_http2: aplogno tags, more unified log formatting git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1782958 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/log-message-tags/next-number b/docs/log-message-tags/next-number index ddf466b9c0..386586617c 100644 --- a/docs/log-message-tags/next-number +++ b/docs/log-message-tags/next-number @@ -1 +1 @@ -3515 +10003 diff --git a/modules/http2/h2_conn.c b/modules/http2/h2_conn.c index 81d2b7f5f3..b13d47f83f 100644 --- a/modules/http2/h2_conn.c +++ b/modules/http2/h2_conn.c @@ -204,18 +204,21 @@ apr_status_t h2_conn_run(struct h2_ctx *ctx, conn_rec *c) { apr_status_t status; int mpm_state = 0; + h2_session *session = h2_ctx_session_get(ctx); + ap_assert(session); do { if (c->cs) { c->cs->sense = CONN_SENSE_DEFAULT; c->cs->state = CONN_STATE_HANDLER; } - status = h2_session_process(h2_ctx_session_get(ctx), async_mpm); + status = h2_session_process(session, async_mpm); if (APR_STATUS_IS_EOF(status)) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, c, APLOGNO(03045) - "h2_session(%ld): process, closing conn", c->id); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, c, + H2_SSSN_LOG(APLOGNO(03045), session, + "process, closing conn")); c->keepalive = AP_CONN_CLOSE; } else { @@ -253,10 +256,11 @@ conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent) apr_pool_t *pool; conn_rec *c; void *cfg; + module *mpm; ap_assert(master); ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, master, - "h2_conn(%ld): create slave", master->id); + "h2_stream(%ld-%d): create slave", master->id, slave_id); /* We create a pool with its own allocator to be used for * processing a request. This is the only way to have the processing @@ -271,7 +275,8 @@ conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent) c = (conn_rec *) apr_palloc(pool, sizeof(conn_rec)); if (c == NULL) { ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_ENOMEM, master, - APLOGNO(02913) "h2_task: creating conn"); + APLOGNO(02913) "h2_session(%ld-%d): create slave", + master->id, slave_id); return NULL; } @@ -304,21 +309,20 @@ conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent) /* TODO: not all mpm modules have learned about slave connections yet. * copy their config from master to slave. */ - if (h2_conn_mpm_module()) { - cfg = ap_get_module_config(master->conn_config, h2_conn_mpm_module()); - ap_set_module_config(c->conn_config, h2_conn_mpm_module(), cfg); + if ((mpm = h2_conn_mpm_module()) != NULL) { + cfg = ap_get_module_config(master->conn_config, mpm); + ap_set_module_config(c->conn_config, mpm, cfg); } ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c, - "h2_task: creating conn, master=%ld, sid=%ld, logid=%s", - master->id, c->id, c->log_id); + "h2_stream(%ld-%d): created slave", master->id, slave_id); return c; } void h2_slave_destroy(conn_rec *slave) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, slave, - "h2_slave_conn(%ld): destroy (task=%s)", slave->id, + "h2_stream(%s): destroy slave", apr_table_get(slave->notes, H2_TASK_ID_NOTE)); apr_pool_destroy(slave->pool); } diff --git a/modules/http2/h2_filter.c b/modules/http2/h2_filter.c index a4ef20d7e9..8c6ffa32f0 100644 --- a/modules/http2/h2_filter.c +++ b/modules/http2/h2_filter.c @@ -113,8 +113,8 @@ apr_status_t h2_filter_core_input(ap_filter_t* f, ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c, "core_input(%ld): read, %s, mode=%d, readbytes=%ld", - (long)f->c->id, (block == APR_BLOCK_READ)? "BLOCK_READ" : "NONBLOCK_READ", - mode, (long)readbytes); + (long)f->c->id, (block == APR_BLOCK_READ)? + "BLOCK_READ" : "NONBLOCK_READ", mode, (long)readbytes); if (mode == AP_MODE_INIT || mode == AP_MODE_SPECULATIVE) { return ap_get_brigade(f->next, brigade, mode, block, readbytes); @@ -161,11 +161,11 @@ apr_status_t h2_filter_core_input(ap_filter_t* f, case APR_EAGAIN: case APR_TIMEUP: ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c, - "core_input(%ld): read", (long)f->c->id); + "core_input(%ld): read", f->c->id); break; default: ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, f->c, APLOGNO(03046) - "h2_conn_io: error reading"); + "core_input(%ld): error reading", f->c->id); break; } return status; diff --git a/modules/http2/h2_mplx.c b/modules/http2/h2_mplx.c index ed71b86077..5f3a0d0635 100644 --- a/modules/http2/h2_mplx.c +++ b/modules/http2/h2_mplx.c @@ -148,12 +148,12 @@ static int can_beam_file(void *ctx, h2_bucket_beam *beam, apr_file_t *file) if (m->tx_handles_reserved > 0) { --m->tx_handles_reserved; ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, m->c, - "h2_mplx(%ld-%d): beaming file %s, tx_avail %d", + "h2_stream(%ld-%d,%s): beaming file, tx_avail %d", m->id, beam->id, beam->tag, m->tx_handles_reserved); return 1; } ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, m->c, - "h2_mplx(%ld-%d): can_beam_file denied on %s", + "h2_stream(%ld-%d,%s): can_beam_file denied", m->id, beam->id, beam->tag); return 0; } @@ -358,8 +358,7 @@ static int stream_destroy_iter(void *ctx, void *val) if (stream->input == NULL || stream->output == NULL) { ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, m->c, - "h2_stream(%ld-%d,%s): already with beams==NULL", - m->id, stream->id, h2_stream_state_str(stream)); + H2_STRM_MSG(stream, "already with beams==NULL")); return 0; } /* Process outstanding events before destruction */ @@ -421,11 +420,11 @@ static int report_stream_iter(void *ctx, void *val) { h2_stream *stream = val; h2_task *task = stream->task; ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c, - H2_STREAM_MSG(stream, "started=%d, scheduled=%d, ready=%d"), + H2_STRM_MSG(stream, "started=%d, scheduled=%d, ready=%d"), !!stream->task, stream->scheduled, h2_stream_is_ready(stream)); if (task) { ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c, /* NO APLOGNO */ - H2_STREAM_MSG(stream, "->03198: %s %s %s" + H2_STRM_MSG(stream, "->03198: %s %s %s" "[started=%d/done=%d/frozen=%d]"), task->request->method, task->request->authority, task->request->path, task->worker_started, @@ -433,7 +432,7 @@ static int report_stream_iter(void *ctx, void *val) { } else { ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c, /* NO APLOGNO */ - H2_STREAM_MSG(stream, "->03198: no task")); + H2_STRM_MSG(stream, "->03198: no task")); } return 1; } @@ -442,8 +441,7 @@ static int unexpected_stream_iter(void *ctx, void *val) { h2_mplx *m = ctx; h2_stream *stream = val; ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, /* NO APLOGNO */ - H2_STREAM_MSG(stream, - "unexpected, started=%d, scheduled=%d, ready=%d"), + H2_STRM_MSG(stream, "unexpected, started=%d, scheduled=%d, ready=%d"), !!stream->task, stream->scheduled, h2_stream_is_ready(stream)); return 1; } @@ -499,8 +497,7 @@ void h2_mplx_release_and_join(h2_mplx *m, apr_thread_cond_t *wait) /* This can happen if we have very long running requests * that do not time out on IO. */ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c, APLOGNO(03198) - "h2_mplx(%ld): release, waiting for %d seconds now for " - "%d outstanding tasks", + "h2_mplx(%ld): waited %d sec for %d tasks", m->id, i*wait_secs, (int)h2_ihash_count(m->shold)); h2_ihash_iter(m->shold, report_stream_iter, m); } @@ -513,7 +510,7 @@ void h2_mplx_release_and_join(h2_mplx *m, apr_thread_cond_t *wait) /* 4. With all workers done, all streams should be in spurge */ if (!h2_ihash_empty(m->shold)) { - ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, APLOGNO() + ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, APLOGNO(03516) "h2_mplx(%ld): unexpected %d streams in hold", m->id, (int)h2_ihash_count(m->shold)); h2_ihash_iter(m->shold, unexpected_stream_iter, m); @@ -536,7 +533,7 @@ apr_status_t h2_mplx_stream_cleanup(h2_mplx *m, h2_stream *stream) if ((status = enter_mutex(m, &acquired)) == APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c, - "h2_mplx(%ld-%d): cleanup stream.", m->id, stream->id); + H2_STRM_MSG(stream, "cleanup")); stream_cleanup(m, stream); leave_mutex(m, acquired); } @@ -737,8 +734,7 @@ apr_status_t h2_mplx_process(h2_mplx *m, struct h2_stream *stream, apr_atomic_set32(&m->event_pending, 1); h2_iq_append(m->readyq, stream->id); ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, m->c, - "h2_mplx(%ld-%d): process, add to readyq", - m->c->id, stream->id); + H2_STRM_MSG(stream, "process, add to readyq")); } else { if (!m->need_registration) { @@ -749,8 +745,7 @@ apr_status_t h2_mplx_process(h2_mplx *m, struct h2_stream *stream, } h2_iq_add(m->q, stream->id, cmp, ctx); ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, m->c, - "h2_mplx(%ld-%d): process, add to q", - m->c->id, stream->id); + H2_STRM_MSG(stream, "process, add to q")); } } leave_mutex(m, acquired); @@ -786,8 +781,7 @@ static h2_task *next_stream_task(h2_mplx *m) slave->sbh = m->c->sbh; slave->aborted = 0; if (!stream->task) { - stream->task = h2_task_create(slave, stream->id, stream->request, - stream->input, stream->output, m); + stream->task = h2_task_create(stream, slave); m->c->keepalives++; apr_table_setn(slave->notes, H2_TASK_ID_NOTE, stream->task->id); @@ -915,7 +909,7 @@ static void task_done(h2_mplx *m, h2_task *task, h2_req_engine *ngn) if (stream) { /* stream not cleaned up, stay around */ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c, - H2_STREAM_MSG(stream, "task_done, stream open")); + H2_STRM_MSG(stream, "task_done, stream open")); /* more data will not arrive, resume the stream */ h2_beam_mutex_set(stream->input, NULL, NULL, NULL); h2_beam_mutex_set(stream->output, NULL, NULL, NULL); @@ -924,7 +918,7 @@ static void task_done(h2_mplx *m, h2_task *task, h2_req_engine *ngn) } else if ((stream = h2_ihash_get(m->shold, task->stream_id)) != NULL) { ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c, - H2_STREAM_MSG(stream, "task_done, in hold")); + H2_STRM_MSG(stream, "task_done, in hold")); /* stream was just waiting for us. */ h2_beam_mutex_set(stream->input, NULL, NULL, NULL); h2_beam_mutex_set(stream->output, NULL, NULL, NULL); @@ -932,13 +926,12 @@ static void task_done(h2_mplx *m, h2_task *task, h2_req_engine *ngn) stream_joined(m, stream); } else if ((stream = h2_ihash_get(m->spurge, task->stream_id)) != NULL) { - ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, APLOGNO() - "h2_mplx(%s): task_done, stream already in spurge", - task->id); + ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, + H2_STRM_LOG(APLOGNO(03517), stream, "already in spurge")); ap_assert("stream should not be in spurge" == NULL); } else { - ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, APLOGNO() + ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c, APLOGNO(03518) "h2_mplx(%s): task_done, stream not found", task->id); ap_assert("stream should still be available" == NULL); diff --git a/modules/http2/h2_proxy_session.c b/modules/http2/h2_proxy_session.c index d61a1413dd..7d28699a37 100644 --- a/modules/http2/h2_proxy_session.c +++ b/modules/http2/h2_proxy_session.c @@ -1470,7 +1470,7 @@ void h2_proxy_session_cleanup(h2_proxy_session *session, cleanup_iter_ctx ctx; ctx.session = session; ctx.done = done; - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03366) + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03519) "h2_proxy_session(%s): terminated, %d streams unfinished", session->id, (int)h2_proxy_ihash_count(session->streams)); h2_proxy_ihash_iter(session->streams, done_iter, &ctx); diff --git a/modules/http2/h2_push.c b/modules/http2/h2_push.c index 4330d7a4dc..307c944742 100644 --- a/modules/http2/h2_push.c +++ b/modules/http2/h2_push.c @@ -700,9 +700,8 @@ apr_array_header_t *h2_push_collect_update(h2_stream *stream, cache_digest, stream->pool); if (status != APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c, - APLOGNO(03057) - "h2_session(%ld): push diary set from Cache-Digest: %s", - session->id, cache_digest); + H2_SSSN_LOG(APLOGNO(03057), session, + "push diary set from Cache-Digest: %s"), cache_digest); } } pushes = h2_push_collect(stream->pool, req, stream->push_policy, res); diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index 33eecad775..d5ac7662ab 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -73,7 +73,7 @@ static void update_window(void *ctx, int stream_id, apr_off_t bytes_read) h2_session *session = (h2_session*)ctx; nghttp2_session_consume(session->ngh2, stream_id, bytes_read); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_session(%ld-%d): consumed %ld bytes", + "h2_stream(%ld-%d): consumed %ld bytes", session->id, stream_id, (long)bytes_read); } @@ -211,9 +211,10 @@ static int on_invalid_frame_recv_cb(nghttp2_session *ngh2, char buffer[256]; h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0])); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03063) - "h2_session(%ld): recv invalid FRAME[%s], frames=%ld/%ld (r/s)", - session->id, buffer, (long)session->frames_received, + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03063), session, + "recv invalid FRAME[%s], frames=%ld/%ld (r/s)"), + buffer, (long)session->frames_received, (long)session->frames_sent); } return 0; @@ -261,8 +262,9 @@ static int on_stream_close_cb(nghttp2_session *ngh2, int32_t stream_id, stream = get_stream(session, stream_id); if (stream) { if (error_code) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03065) - H2_STREAM_MSG(stream, "closing with err=%d %s"), + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03065), stream, + "closing with err=%d %s"), (int)error_code, h2_h2_err_description(error_code)); h2_stream_rst(stream, error_code); } @@ -302,9 +304,8 @@ static int on_header_cb(nghttp2_session *ngh2, const nghttp2_frame *frame, (void)flags; stream = get_stream(session, frame->hd.stream_id); if (!stream) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, - APLOGNO(02920) - "h2_session: stream(%ld-%d): on_header unknown stream", + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(02920) + "h2_stream(%ld-%d): on_header unknown stream", session->id, (int)frame->hd.stream_id); return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } @@ -333,9 +334,10 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, char buffer[256]; h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0])); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03066) - "h2_session(%ld): recv FRAME[%s], frames=%ld/%ld (r/s)", - session->id, buffer, (long)session->frames_received, + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03066), session, + "recv FRAME[%s], frames=%ld/%ld (r/s)"), + buffer, (long)session->frames_received, (long)session->frames_sent); } @@ -353,8 +355,9 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, case NGHTTP2_DATA: stream = get_stream(session, frame->hd.stream_id); if (stream) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(02923) - H2_STREAM_MSG(stream, "DATA, len=%ld, flags=%d"), + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(02923), stream, + "DATA, len=%ld, flags=%d"), (long)frame->hd.length, frame->hd.flags); h2_stream_recv_frame(stream, NGHTTP2_DATA, frame->hd.flags); } @@ -362,7 +365,7 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, case NGHTTP2_PRIORITY: session->reprioritize = 1; ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_session: stream(%ld-%d): PRIORITY frame " + "h2_stream(%ld-%d): PRIORITY frame " " weight=%d, dependsOn=%d, exclusive=%d", session->id, (int)frame->hd.stream_id, frame->priority.pri_spec.weight, @@ -371,14 +374,13 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, break; case NGHTTP2_WINDOW_UPDATE: ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_session: stream(%ld-%d): WINDOW_UPDATE " - "incr=%d", + "h2_stream(%ld-%d): WINDOW_UPDATE incr=%d", session->id, (int)frame->hd.stream_id, frame->window_update.window_size_increment); break; case NGHTTP2_RST_STREAM: ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03067) - "h2_session(%ld-%d): RST_STREAM by client, errror=%d", + "h2_stream(%ld-%d): RST_STREAM by client, errror=%d", session->id, (int)frame->hd.stream_id, (int)frame->rst_stream.error_code); stream = get_stream(session, frame->hd.stream_id); @@ -408,7 +410,7 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0])); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_session: on_frame_rcv %s", buffer); + H2_SSSN_MSG(session, "on_frame_rcv %s"), buffer); } break; } @@ -454,19 +456,19 @@ static int on_send_data_cb(nghttp2_session *ngh2, } padlen = (unsigned char)frame->data.padlen; - ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_stream(%ld-%d): send_data_cb for %ld bytes", - session->id, (int)stream_id, (long)length); - stream = get_stream(session, stream_id); if (!stream) { ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_NOTFOUND, session->c, APLOGNO(02924) - "h2_stream(%ld-%d): send_data, lookup stream", + "h2_stream(%ld-%d): send_data, stream not found", session->id, (int)stream_id); return NGHTTP2_ERR_CALLBACK_FAILURE; } + ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, + H2_STRM_MSG(stream, "send_data_cb for %ld bytes"), + (long)length); + status = h2_conn_io_write(&session->io, (const char *)framehd, 9); if (padlen && status == APR_SUCCESS) { status = h2_conn_io_write(&session->io, (const char *)&padlen, 1); @@ -474,20 +476,20 @@ static int on_send_data_cb(nghttp2_session *ngh2, if (status != APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, session->c, - H2_STREAM_MSG(stream, "writing frame header")); + H2_STRM_MSG(stream, "writing frame header")); return NGHTTP2_ERR_CALLBACK_FAILURE; } status = h2_stream_read_to(stream, session->bbtmp, &len, &eos); if (status != APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, session->c, - H2_STREAM_MSG(stream, "send_data_cb, reading stream")); + H2_STRM_MSG(stream, "send_data_cb, reading stream")); apr_brigade_cleanup(session->bbtmp); return NGHTTP2_ERR_CALLBACK_FAILURE; } else if (len != length) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, session->c, - H2_STREAM_MSG(stream, "send_data_cb, wanted %ld bytes, " + H2_STRM_MSG(stream, "send_data_cb, wanted %ld bytes, " "got %ld from stream"), (long)length, (long)len); apr_brigade_cleanup(session->bbtmp); return NGHTTP2_ERR_CALLBACK_FAILURE; @@ -508,8 +510,8 @@ static int on_send_data_cb(nghttp2_session *ngh2, return 0; } else { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c, APLOGNO(02925) - H2_STREAM_MSG(stream, "failed send_data_cb")); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c, + H2_STRM_LOG(APLOGNO(02925), stream, "failed send_data_cb")); return NGHTTP2_ERR_CALLBACK_FAILURE; } } @@ -536,9 +538,10 @@ static int on_frame_send_cb(nghttp2_session *ngh2, char buffer[256]; h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0])); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03068) - "h2_session(%ld): sent FRAME[%s], frames=%ld/%ld (r/s)", - session->id, buffer, (long)session->frames_received, + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03068), session, + "sent FRAME[%s], frames=%ld/%ld (r/s)"), + buffer, (long)session->frames_received, (long)session->frames_sent); } @@ -561,8 +564,8 @@ static int on_invalid_header_cb(nghttp2_session *ngh2, if (APLOGcdebug(session->c)) { ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03456) - "h2_session(%ld-%d): denying stream with invalid header " - "'%s: %s'", session->id, (int)frame->hd.stream_id, + "h2_stream(%ld-%d): invalid header '%s: %s'", + session->id, (int)frame->hd.stream_id, apr_pstrndup(session->pool, (const char *)name, namelen), apr_pstrndup(session->pool, (const char *)value, valuelen)); } @@ -617,8 +620,8 @@ static apr_status_t h2_session_shutdown_notice(h2_session *session) if (status == APR_SUCCESS) { status = h2_conn_io_flush(&session->io); } - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03457) - "session(%ld): sent shutdown notice", session->id); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03457), session, "sent shutdown notice")); return status; } @@ -660,9 +663,9 @@ static apr_status_t h2_session_shutdown(h2_session *session, int error, if (status == APR_SUCCESS) { status = h2_conn_io_flush(&session->io); } - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03069) - "session(%ld): sent GOAWAY, err=%d, msg=%s", - session->id, error, msg? msg : ""); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03069), session, + "sent GOAWAY, err=%d, msg=%s"), error, msg? msg : ""); dispatch_event(session, H2_SESSION_EV_LOCAL_GOAWAY, error, msg); return status; } @@ -671,7 +674,7 @@ static apr_status_t session_pool_cleanup(void *data) { h2_session *session = data; ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - "session(%ld): pool_cleanup", session->id); + H2_SSSN_MSG(session, "pool_cleanup")); if (session->state != H2_SESSION_ST_DONE && session->state != H2_SESSION_ST_INIT) { @@ -683,10 +686,10 @@ static apr_status_t session_pool_cleanup(void *data) * connection when sending the next request, this has the effect * that at least this one request will fail. */ - ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, session->c, APLOGNO(03199) - "session(%ld): connection disappeared without proper " - "goodbye, clients will be confused, should not happen", - session->id); + ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, session->c, + H2_SSSN_LOG(APLOGNO(03199), session, + "connection disappeared without proper " + "goodbye, clients will be confused, should not happen")); } transit(session, "pool cleanup", H2_SESSION_ST_CLEANUP); @@ -701,44 +704,6 @@ static apr_status_t session_pool_cleanup(void *data) return APR_SUCCESS; } -static void *session_malloc(size_t size, void *ctx) -{ - h2_session *session = ctx; - ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, session->c, - "h2_session(%ld): malloc(%ld)", - session->id, (long)size); - return malloc(size); -} - -static void session_free(void *p, void *ctx) -{ - h2_session *session = ctx; - - ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, session->c, - "h2_session(%ld): free()", - session->id); - free(p); -} - -static void *session_calloc(size_t n, size_t size, void *ctx) -{ - h2_session *session = ctx; - - ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, session->c, - "h2_session(%ld): calloc(%ld, %ld)", - session->id, (long)n, (long)size); - return calloc(n, size); -} - -static void *session_realloc(void *p, size_t size, void *ctx) -{ - h2_session *session = ctx; - ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, session->c, - "h2_session(%ld): realloc(%ld)", - session->id, (long)size); - return realloc(p, size); -} - static h2_session *h2_session_create_int(conn_rec *c, request_rec *r, h2_ctx *ctx, @@ -761,8 +726,6 @@ static h2_session *h2_session_create_int(conn_rec *c, session = apr_pcalloc(pool, sizeof(h2_session)); if (session) { int rv; - nghttp2_mem *mem; - session->id = c->id; session->c = c; session->r = r; @@ -828,21 +791,8 @@ static h2_session *h2_session_create_int(conn_rec *c, * get flooded by nghttp2. */ nghttp2_option_set_no_auto_window_update(options, 1); - if (APLOGctrace6(c)) { - mem = apr_pcalloc(session->pool, sizeof(nghttp2_mem)); - mem->mem_user_data = session; - mem->malloc = session_malloc; - mem->free = session_free; - mem->calloc = session_calloc; - mem->realloc = session_realloc; - - rv = nghttp2_session_server_new3(&session->ngh2, callbacks, - session, options, mem); - } - else { - rv = nghttp2_session_server_new2(&session->ngh2, callbacks, - session, options); - } + rv = nghttp2_session_server_new2(&session->ngh2, callbacks, + session, options); nghttp2_session_callbacks_del(callbacks); nghttp2_option_del(options); @@ -857,11 +807,12 @@ static h2_session *h2_session_create_int(conn_rec *c, session->push_diary = h2_push_diary_create(session->pool, n); if (APLOGcdebug(c)) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(03200) - "h2_session(%ld) created, max_streams=%d, " - "stream_mem=%d, workers_limit=%d, workers_max=%d, " - "push_diary(type=%d,N=%d)", - session->id, (int)session->max_stream_count, + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, + H2_SSSN_LOG(APLOGNO(03200), session, + "created, max_streams=%d, stream_mem=%d, " + "workers_limit=%d, workers_max=%d, " + "push_diary(type=%d,N=%d)"), + (int)session->max_stream_count, (int)session->max_stream_mem, session->mplx->workers_limit, session->mplx->workers_max, @@ -953,17 +904,17 @@ static apr_status_t h2_session_start(h2_session *session, int *rv) ++slen; } - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c, APLOGNO(03201) - "h2_session(%ld): start, INITIAL_WINDOW_SIZE=%ld, " - "MAX_CONCURRENT_STREAMS=%d", - session->id, (long)win_size, (int)session->max_stream_count); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c, + H2_SSSN_LOG(APLOGNO(03201), session, + "start, INITIAL_WINDOW_SIZE=%ld, MAX_CONCURRENT_STREAMS=%d"), + (long)win_size, (int)session->max_stream_count); *rv = nghttp2_submit_settings(session->ngh2, NGHTTP2_FLAG_NONE, settings, slen); if (*rv != 0) { status = APR_EGENERAL; ap_log_cerror(APLOG_MARK, APLOG_ERR, status, session->c, - APLOGNO(02935) "nghttp2_submit_settings: %s", - nghttp2_strerror(*rv)); + H2_SSSN_LOG(APLOGNO(02935), session, + "nghttp2_submit_settings: %s"), nghttp2_strerror(*rv)); } else { /* use maximum possible value for connection window size. We are only @@ -980,7 +931,8 @@ static apr_status_t h2_session_start(h2_session *session, int *rv) if (*rv != 0) { status = APR_EGENERAL; ap_log_cerror(APLOG_MARK, APLOG_ERR, status, session->c, - APLOGNO(02970) "nghttp2_submit_window_update: %s", + H2_SSSN_LOG(APLOGNO(02970), session, + "nghttp2_submit_window_update: %s"), nghttp2_strerror(*rv)); } } @@ -1021,7 +973,7 @@ static ssize_t stream_data_cb(nghttp2_session *ng2s, if (!stream) { ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, session->c, APLOGNO(02937) - "h2_stream(%ld-%d): data requested but stream not found", + "h2_stream(%ld-%d): data_cb, stream not found", session->id, (int)stream_id); return NGHTTP2_ERR_CALLBACK_FAILURE; } @@ -1029,7 +981,7 @@ static ssize_t stream_data_cb(nghttp2_session *ng2s, status = h2_stream_out_prepare(stream, &nread, &eos, NULL); if (nread) { ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - H2_STREAM_MSG(stream, "prepared no_copy, len=%ld, eos=%d"), + H2_STRM_MSG(stream, "prepared no_copy, len=%ld, eos=%d"), (long)nread, eos); *data_flags |= NGHTTP2_DATA_FLAG_NO_COPY; } @@ -1047,14 +999,14 @@ static ssize_t stream_data_cb(nghttp2_session *ng2s, * it. Remember at our h2_stream that we need to do this. */ nread = 0; - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03071) - H2_STREAM_MSG(stream, "suspending")); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03071), stream, "suspending")); return NGHTTP2_ERR_DEFERRED; default: nread = 0; - ap_log_cerror(APLOG_MARK, APLOG_ERR, status, session->c, APLOGNO(02938) - H2_STREAM_MSG(stream, "reading data")); + ap_log_cerror(APLOG_MARK, APLOG_ERR, status, session->c, + H2_STRM_LOG(APLOGNO(02938), stream, "reading data")); return NGHTTP2_ERR_CALLBACK_FAILURE; } @@ -1075,22 +1027,22 @@ struct h2_stream *h2_session_push(h2_session *session, h2_stream *is, nid = nghttp2_submit_push_promise(session->ngh2, 0, is->id, ngh->nv, ngh->nvlen, NULL); if (nid <= 0) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03075) - H2_STREAM_MSG(is, "submitting push promise fail: %s"), - nghttp2_strerror(nid)); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03075), is, + "submitting push promise fail: %s"), nghttp2_strerror(nid)); return NULL; } ++session->pushes_promised; - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03076) - H2_STREAM_MSG(is, "SERVER_PUSH %d for %s %s on %d"), + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03076), is, "SERVER_PUSH %d for %s %s on %d"), nid, push->req->method, push->req->path, is->id); stream = h2_session_open_stream(session, nid, is->id); if (!stream) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03077) - H2_STREAM_MSG(stream, "failed to create stream obj %d"), - nid); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03077), stream, + "failed to create stream obj %d"), nid); /* kill the push_promise */ nghttp2_submit_rst_stream(session->ngh2, NGHTTP2_FLAG_NONE, nid, NGHTTP2_INTERNAL_ERROR); @@ -1124,7 +1076,7 @@ apr_status_t h2_session_set_prio(h2_session *session, h2_stream *stream, s = nghttp2_session_find_stream(session->ngh2, stream->id); if (!s) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - H2_STREAM_MSG(stream, "lookup of nghttp2_stream failed")); + H2_STRM_MSG(stream, "lookup of nghttp2_stream failed")); return APR_EINVAL; } @@ -1194,8 +1146,9 @@ apr_status_t h2_session_set_prio(h2_session *session, h2_stream *stream, rv = nghttp2_session_change_stream_priority(session->ngh2, stream->id, &ps); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03203) - H2_STREAM_MSG(stream, "PUSH %s, weight=%d, depends=%d, returned=%d"), + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + ""H2_STRM_LOG(APLOGNO(03203), stream, + "PUSH %s, weight=%d, depends=%d, returned=%d"), ptype, ps.weight, ps.stream_id, rv); status = (rv < 0)? APR_EGENERAL : APR_SUCCESS; } @@ -1260,7 +1213,7 @@ static apr_status_t on_stream_headers(h2_session *session, h2_stream *stream, ap_assert(session); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - H2_STREAM_MSG(stream, "on_headers")); + H2_STRM_MSG(stream, "on_headers")); if (headers->status < 100) { h2_stream_rst(stream, headers->status); goto leave; @@ -1269,8 +1222,8 @@ static apr_status_t on_stream_headers(h2_session *session, h2_stream *stream, h2_ngheader *nh; nh = h2_util_ngheader_make(stream->pool, headers->headers); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03072) - H2_STREAM_MSG(stream, "submit %d trailers"), (int)nh->nvlen); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03072), stream, "submit %d trailers"), (int)nh->nvlen); rv = nghttp2_submit_trailer(session->ngh2, stream->id, nh->nv, nh->nvlen); goto leave; } @@ -1280,8 +1233,8 @@ static apr_status_t on_stream_headers(h2_session *session, h2_stream *stream, apr_table_t *hout; const char *note; - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03073) - H2_STREAM_MSG(stream, "submit response %d, REMOTE_WINDOW_SIZE=%u"), + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03073), stream, "submit response %d, REMOTE_WINDOW_SIZE=%u"), headers->status, (unsigned int)nghttp2_session_get_stream_remote_window_size(session->ngh2, stream->id)); @@ -1398,13 +1351,13 @@ static apr_status_t on_stream_resume(void *ctx, h2_stream *stream) ap_assert(stream); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - H2_STREAM_MSG(stream, "on_resume")); + H2_STRM_MSG(stream, "on_resume")); send_headers: headers = NULL; status = h2_stream_out_prepare(stream, &len, &eos, &headers); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, session->c, - H2_STREAM_MSG(stream, "prepared len=%ld, eos=%d"), + H2_STRM_MSG(stream, "prepared len=%ld, eos=%d"), (long)len, eos); if (headers) { status = on_stream_headers(session, stream, headers, len, eos); @@ -1417,16 +1370,16 @@ send_headers: /* we have DATA to send */ if (!stream->has_response) { /* but no response */ - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03466) - H2_STREAM_MSG(stream, "no response, RST_STREAM")); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03466), stream, "no response, RST_STREAM")); h2_stream_rst(stream, H2_ERR_PROTOCOL_ERROR); return APR_SUCCESS; } rv = nghttp2_session_resume_data(session->ngh2, stream->id); session->have_written = 1; ap_log_cerror(APLOG_MARK, nghttp2_is_fatal(rv)? - APLOG_ERR : APLOG_DEBUG, 0, session->c, APLOGNO(02936) - H2_STREAM_MSG(stream, "resumed")); + APLOG_ERR : APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(02936), stream, "resumed")); } return status; } @@ -1439,8 +1392,8 @@ static apr_status_t h2_session_receive(void *ctx, const char *data, if (len > 0) { ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_session(%ld): feeding %ld bytes to nghttp2", - session->id, (long)len); + H2_SSSN_MSG(session, "feeding %ld bytes to nghttp2"), + (long)len); n = nghttp2_session_mem_recv(session->ngh2, (const uint8_t *)data, len); if (n < 0) { if (nghttp2_is_fatal((int)n)) { @@ -1495,15 +1448,14 @@ static apr_status_t h2_session_read(h2_session *session, int block) || APR_STATUS_IS_EOF(status) || APR_STATUS_IS_EBADF(status)) { /* common status for a client that has left */ - ap_log_cerror( APLOG_MARK, APLOG_TRACE1, status, c, - "h2_session(%ld): input gone", session->id); + ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, c, + H2_SSSN_MSG(session, "input gone")); } else { /* uncommon status, log on INFO so that we see this */ ap_log_cerror( APLOG_MARK, APLOG_DEBUG, status, c, - APLOGNO(02950) - "h2_session(%ld): error reading, terminating", - session->id); + H2_SSSN_LOG(APLOGNO(02950), session, + "error reading, terminating")); } return status; } @@ -1514,7 +1466,7 @@ static apr_status_t h2_session_read(h2_session *session, int block) if ((session->io.bytes_read - read_start) > (64*1024)) { /* read enough in one go, give write a chance */ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, c, - "h2_session(%ld): read 64k, returning", session->id); + H2_SSSN_MSG(session, "read 64k, returning")); break; } } @@ -1530,7 +1482,7 @@ static const char *StateNames[] = { "CLEANUP", /* H2_SESSION_ST_CLEANUP */ }; -static const char *state_name(h2_session_state state) +const char *h2_session_state_str(h2_session_state state) { if (state >= (sizeof(StateNames)/sizeof(StateNames[0]))) { return "unknown"; @@ -1564,9 +1516,11 @@ static void transit(h2_session *session, const char *action, h2_session_state ns || (session->state == H2_SESSION_ST_WAIT && nstate == H2_SESSION_ST_BUSY)){ loglvl = APLOG_TRACE1; } - ap_log_cerror(APLOG_MARK, loglvl, 0, session->c, APLOGNO(03078) - "h2_session(%ld): transit [%s] -- %s --> [%s]", session->id, - state_name(session->state), action, state_name(nstate)); + ap_log_cerror(APLOG_MARK, loglvl, 0, session->c, + H2_SSSN_LOG(APLOGNO(03078), session, + "transit [%s] -- %s --> [%s]"), + h2_session_state_str(session->state), action, + h2_session_state_str(nstate)); session->state = nstate; switch (session->state) { case H2_SESSION_ST_IDLE: @@ -1627,8 +1581,9 @@ static void h2_session_ev_conn_error(h2_session *session, int arg, const char *m break; default: - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03401) - "h2_session(%ld): conn error -> shutdown", session->id); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03401), session, + "conn error -> shutdown")); h2_session_shutdown(session, arg, msg, 0); break; } @@ -1637,8 +1592,9 @@ static void h2_session_ev_conn_error(h2_session *session, int arg, const char *m static void h2_session_ev_proto_error(h2_session *session, int arg, const char *msg) { if (!session->local.shutdown) { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03402) - "h2_session(%ld): proto error -> shutdown", session->id); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_SSSN_LOG(APLOGNO(03402), session, + "proto error -> shutdown")); h2_session_shutdown(session, arg, msg, 0); } } @@ -1662,8 +1618,8 @@ static void h2_session_ev_no_io(h2_session *session, int arg, const char *msg) * - we have finished all streams and the client has sent GO_AWAY */ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - "h2_session(%ld): NO_IO event, %d streams open", - session->id, session->open_streams); + H2_SSSN_MSG(session, "NO_IO event, %d streams open"), + session->open_streams); h2_conn_io_flush(&session->io); if (session->open_streams > 0) { if (h2_mplx_awaits_data(session->mplx)) { @@ -1768,7 +1724,7 @@ static void ev_stream_open(h2_session *session, h2_stream *stream) if (stream->request) { const h2_request *r = stream->request; ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - H2_STREAM_MSG(stream, "schedule %s %s://%s%s chunked=%d"), + H2_STRM_MSG(stream, "schedule %s %s://%s%s chunked=%d"), r->method, r->scheme, r->authority, r->path, r->chunked); stream->scheduled = 1; h2_mplx_process(session->mplx, stream, stream_pri_cmp, session); @@ -1814,7 +1770,7 @@ static void on_stream_state_enter(void *ctx, h2_stream *stream) h2_session *session = ctx; /* stream entered a new state */ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, - H2_STREAM_MSG(stream, "entered state")); + H2_STRM_MSG(stream, "entered state")); switch (stream->state) { case H2_SS_IDLE: /* stream was created */ ++session->open_streams; @@ -1908,8 +1864,7 @@ static void dispatch_event(h2_session *session, h2_session_event_t ev, break; default: ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - "h2_session(%ld): unknown event %d", - session->id, ev); + H2_SSSN_MSG(session, "unknown event %d"), ev); break; } } @@ -1922,11 +1877,11 @@ static apr_status_t dispatch_master(h2_session *session) { on_stream_resume, session); if (status == APR_EAGAIN) { ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, session->c, - "h2_session(%ld): no master event available", session->id); + H2_SSSN_MSG(session, "no master event available")); } else if (status != APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, session->c, - "h2_session(%ld): dispatch error", session->id); + H2_SSSN_MSG(session, "dispatch error")); dispatch_event(session, H2_SESSION_EV_CONN_ERROR, H2_ERR_INTERNAL_ERROR, "dispatch error"); } @@ -1943,8 +1898,7 @@ apr_status_t h2_session_process(h2_session *session, int async) if (trace) { ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): process start, async=%d", - session->id, async); + H2_SSSN_MSG(session, "process start, async=%d"), async); } while (session->state != H2_SESSION_ST_DONE) { @@ -1964,18 +1918,22 @@ apr_status_t h2_session_process(h2_session *session, int async) case H2_SESSION_ST_INIT: ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_READ, c); if (!h2_is_acceptable_connection(c, 1)) { - update_child_status(session, SERVER_BUSY_READ, "inadequate security"); - h2_session_shutdown(session, NGHTTP2_INADEQUATE_SECURITY, NULL, 1); + update_child_status(session, SERVER_BUSY_READ, + "inadequate security"); + h2_session_shutdown(session, + NGHTTP2_INADEQUATE_SECURITY, NULL, 1); } else { update_child_status(session, SERVER_BUSY_READ, "init"); status = h2_session_start(session, &rv); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, c, APLOGNO(03079) - "h2_session(%ld): started on %s:%d", session->id, + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, c, + H2_SSSN_LOG(APLOGNO(03079), session, + "started on %s:%d"), session->s->server_hostname, c->local_addr->port); if (status != APR_SUCCESS) { - dispatch_event(session, H2_SESSION_EV_CONN_ERROR, 0, NULL); + dispatch_event(session, + H2_SESSION_EV_CONN_ERROR, 0, NULL); } dispatch_event(session, H2_SESSION_EV_INIT, 0, NULL); } @@ -1995,9 +1953,9 @@ apr_status_t h2_session_process(h2_session *session, int async) if (!session->keep_sync_until && async && !session->open_streams && !session->r && session->remote.emitted_count) { if (trace) { - ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): async idle, nonblock read, " - "%d streams open", session->id, + ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, c, + H2_SSSN_MSG(session, + "nonblock read, %d streams open"), session->open_streams); } status = h2_session_read(session, 0); @@ -2006,9 +1964,11 @@ apr_status_t h2_session_process(h2_session *session, int async) session->have_read = 1; dispatch_event(session, H2_SESSION_EV_DATA_READ, 0, NULL); } - else if (APR_STATUS_IS_EAGAIN(status) || APR_STATUS_IS_TIMEUP(status)) { + else if (APR_STATUS_IS_EAGAIN(status) + || APR_STATUS_IS_TIMEUP(status)) { if (apr_time_now() > session->idle_until) { - dispatch_event(session, H2_SESSION_EV_CONN_TIMEOUT, 0, NULL); + dispatch_event(session, + H2_SESSION_EV_CONN_TIMEOUT, 0, NULL); } else { status = APR_EAGAIN; @@ -2016,18 +1976,18 @@ apr_status_t h2_session_process(h2_session *session, int async) } } else { - ap_log_cerror( APLOG_MARK, APLOG_DEBUG, status, c, - APLOGNO(03403) - "h2_session(%ld): idle, no data, error", - session->id); - dispatch_event(session, H2_SESSION_EV_CONN_ERROR, 0, "timeout"); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, c, + H2_SSSN_LOG(APLOGNO(03403), session, + "no data, error")); + dispatch_event(session, + H2_SESSION_EV_CONN_ERROR, 0, "timeout"); } } else { if (trace) { - ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): sync idle, stutter 1-sec, " - "%d streams open", session->id, + ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, c, + H2_SSSN_MSG(session, + "sync, stutter 1-sec, %d streams open"), session->open_streams); } /* We wait in smaller increments, using a 1 second timeout. @@ -2056,16 +2016,18 @@ apr_status_t h2_session_process(h2_session *session, int async) } if (now > session->idle_until) { if (trace) { - ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): keepalive timeout", - session->id); + ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, c, + H2_SSSN_MSG(session, + "keepalive timeout")); } - dispatch_event(session, H2_SESSION_EV_CONN_TIMEOUT, 0, "timeout"); + dispatch_event(session, + H2_SESSION_EV_CONN_TIMEOUT, 0, "timeout"); } else if (trace) { - ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): keepalive, %f sec left", - session->id, (session->idle_until - now) / 1000000.0f); + ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, c, + H2_SSSN_MSG(session, + "keepalive, %f sec left"), + (session->idle_until - now) / 1000000.0f); } /* continue reading handling */ } @@ -2074,13 +2036,13 @@ apr_status_t h2_session_process(h2_session *session, int async) || APR_STATUS_IS_EOF(status) || APR_STATUS_IS_EBADF(status)) { ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): input gone", session->id); + H2_SSSN_MSG(session, "input gone")); dispatch_event(session, H2_SESSION_EV_CONN_ERROR, 0, NULL); } else { ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): idle(1 sec timeout) " - "read failed", session->id); + H2_SSSN_MSG(session, + "(1 sec timeout) read failed")); dispatch_event(session, H2_SESSION_EV_CONN_ERROR, 0, "error"); } } @@ -2170,9 +2132,8 @@ apr_status_t h2_session_process(h2_session *session, int async) } else { ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, c, - APLOGNO(03404) - "h2_session(%ld): waiting on conditional", - session->id); + H2_SSSN_LOG(APLOGNO(03404), session, + "waiting on conditional")); h2_session_shutdown(session, H2_ERR_INTERNAL_ERROR, "cond wait error", 0); } @@ -2180,8 +2141,8 @@ apr_status_t h2_session_process(h2_session *session, int async) default: ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_EGENERAL, c, - APLOGNO(03080) - "h2_session(%ld): unknown state %d", session->id, session->state); + H2_SSSN_LOG(APLOGNO(03080), session, + "unknown state")); dispatch_event(session, H2_SESSION_EV_PROTO_ERROR, 0, NULL); break; } @@ -2199,8 +2160,7 @@ apr_status_t h2_session_process(h2_session *session, int async) out: if (trace) { ap_log_cerror( APLOG_MARK, APLOG_TRACE3, status, c, - "h2_session(%ld): [%s] process returns", - session->id, state_name(session->state)); + H2_SSSN_MSG(session, "process returns")); } if ((session->state != H2_SESSION_ST_DONE) @@ -2221,7 +2181,7 @@ out: apr_status_t h2_session_pre_close(h2_session *session, int async) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - "h2_session(%ld): pre_close", session->id); + H2_SSSN_MSG(session, "pre_close")); dispatch_event(session, H2_SESSION_EV_PRE_CLOSE, 0, (session->state == H2_SESSION_ST_IDLE)? "timeout" : NULL); return APR_SUCCESS; diff --git a/modules/http2/h2_session.h b/modules/http2/h2_session.h index 6527146bad..e674e35035 100644 --- a/modules/http2/h2_session.h +++ b/modules/http2/h2_session.h @@ -127,6 +127,7 @@ typedef struct h2_session { const char *last_status_msg; /* the one already reported */ } h2_session; +const char *h2_session_state_str(h2_session_state state); /** * Create a new h2_session for the given connection. @@ -198,4 +199,9 @@ apr_status_t h2_session_set_prio(h2_session *session, struct h2_stream *stream, const struct h2_priority *prio); +#define H2_SSSN_MSG(s, msg) \ + "h2_session(%ld,%s): "msg, s->id, h2_session_state_str(s->state) + +#define H2_SSSN_LOG(aplogno, s, msg) aplogno H2_SSSN_MSG(s, msg) + #endif /* defined(__mod_h2__h2_session__) */ diff --git a/modules/http2/h2_stream.c b/modules/http2/h2_stream.c index 4eb1ae6c01..abc85fd4ac 100644 --- a/modules/http2/h2_stream.c +++ b/modules/http2/h2_stream.c @@ -183,7 +183,7 @@ static apr_status_t close_input(h2_stream *stream) } ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "closing input")); + H2_STRM_MSG(stream, "closing input")); if (stream->rst_error) { return APR_ECONNRESET; } @@ -196,7 +196,7 @@ static apr_status_t close_input(h2_stream *stream) APR_BRIGADE_INSERT_TAIL(tmp, b); stream->trailers = NULL; ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c, - H2_STREAM_MSG(stream, "added trailers")); + H2_STRM_MSG(stream, "added trailers")); } b = apr_bucket_eos_create(c->bucket_alloc); @@ -213,7 +213,7 @@ static apr_status_t close_output(h2_stream *stream) return APR_SUCCESS; } ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "closing output")); + H2_STRM_MSG(stream, "closing output")); return h2_beam_leave(stream->output); } @@ -238,7 +238,7 @@ static void on_state_invalid(h2_stream *stream) } /* stream got an event/frame invalid in its state */ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "invalid state event")); + H2_STRM_MSG(stream, "invalid state event")); switch (stream->state) { case H2_SS_OPEN: case H2_SS_RSVD_L: @@ -258,14 +258,14 @@ static apr_status_t transit(h2_stream *stream, int new_state) return APR_SUCCESS; } else if (new_state < 0) { - ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, stream->session->c, APLOGNO(03081) - H2_STREAM_MSG(stream, "invalid transition")); + ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, stream->session->c, + H2_STRM_LOG(APLOGNO(03081), stream, "invalid transition")); on_state_invalid(stream); return APR_EINVAL; } ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "transit to [%s]"), h2_ss_str(new_state)); + H2_STRM_MSG(stream, "transit to [%s]"), h2_ss_str(new_state)); stream->state = new_state; switch (new_state) { case H2_SS_IDLE: @@ -307,11 +307,11 @@ void h2_stream_dispatch(h2_stream *stream, h2_stream_event_t ev) int new_state; ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c, - H2_STREAM_MSG(stream, "dispatch event %d"), ev); + H2_STRM_MSG(stream, "dispatch event %d"), ev); new_state = on_event(stream->state, ev); if (new_state < 0) { - ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, stream->session->c, APLOGNO(03081) - H2_STREAM_MSG(stream, "invalid event %d"), ev); + ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, stream->session->c, + H2_STRM_LOG(APLOGNO(10002), stream, "invalid event %d"), ev); on_state_invalid(stream); AP_DEBUG_ASSERT(new_state > S_XXX); return; @@ -319,7 +319,7 @@ void h2_stream_dispatch(h2_stream *stream, h2_stream_event_t ev) else if (new_state == stream->state) { /* nop */ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c, - H2_STREAM_MSG(stream, "ignored event %d"), ev); + H2_STRM_MSG(stream, "ignored event %d"), ev); return; } else { @@ -344,7 +344,7 @@ apr_status_t h2_stream_send_frame(h2_stream *stream, int ftype, int flags) new_state = on_frame_send(stream->state, ftype); if (new_state < 0) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "invalid frame %d send"), ftype); + H2_STRM_MSG(stream, "invalid frame %d send"), ftype); AP_DEBUG_ASSERT(new_state > S_XXX); return transit(stream, new_state); } @@ -375,7 +375,7 @@ apr_status_t h2_stream_send_frame(h2_stream *stream, int ftype, int flags) break; } ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "send frame %d, eos=%d"), ftype, eos); + H2_STRM_MSG(stream, "send frame %d, eos=%d"), ftype, eos); status = transit(stream, new_state); if (status == APR_SUCCESS && eos) { status = transit(stream, on_event(stream->state, H2_SEV_CLOSED_L)); @@ -391,7 +391,7 @@ apr_status_t h2_stream_recv_frame(h2_stream *stream, int ftype, int flags) new_state = on_frame_recv(stream->state, ftype); if (new_state < 0) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "invalid frame %d recv"), ftype); + H2_STRM_MSG(stream, "invalid frame %d recv"), ftype); AP_DEBUG_ASSERT(new_state > S_XXX); return transit(stream, new_state); } @@ -446,7 +446,7 @@ apr_status_t h2_stream_recv_DATA(h2_stream *stream, uint8_t flags, } ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, session->c, - H2_STREAM_MSG(stream, "recv DATA, len=%d"), (int)len); + H2_STRM_MSG(stream, "recv DATA, len=%d"), (int)len); tmp = apr_brigade_create(stream->pool, session->c->bucket_alloc); apr_brigade_write(tmp, NULL, NULL, (const char *)data, len); @@ -482,8 +482,8 @@ h2_stream *h2_stream_create(int id, apr_pool_t *pool, h2_session *session, h2_beam_send_from(stream->input, stream->pool); h2_beam_create(&stream->output, pool, id, "output", H2_BEAM_OWNER_RECV, 0); - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03082) - H2_STREAM_MSG(stream, "created")); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, + H2_STRM_LOG(APLOGNO(03082), stream, "created")); on_state_enter(stream); return stream; } @@ -502,10 +502,10 @@ void h2_stream_cleanup(h2_stream *stream) status = h2_beam_wait_empty(stream->input, APR_NONBLOCK_READ); if (status == APR_EAGAIN) { ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c, - H2_STREAM_MSG(stream, "wait on input drain")); + H2_STRM_MSG(stream, "wait on input drain")); status = h2_beam_wait_empty(stream->input, APR_BLOCK_READ); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, stream->session->c, - H2_STREAM_MSG(stream, "input drain returned")); + H2_STRM_MSG(stream, "input drain returned")); } } @@ -513,7 +513,7 @@ void h2_stream_destroy(h2_stream *stream) { ap_assert(stream); ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, stream->session->c, - H2_STREAM_MSG(stream, "destroy")); + H2_STRM_MSG(stream, "destroy")); if (stream->pool) { apr_pool_destroy(stream->pool); stream->pool = NULL; @@ -533,7 +533,7 @@ void h2_stream_rst(h2_stream *stream, int error_code) h2_beam_abort(stream->input); h2_beam_leave(stream->output); ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "reset, error=%d"), error_code); + H2_STRM_MSG(stream, "reset, error=%d"), error_code); h2_stream_dispatch(stream, H2_SEV_CANCELLED); } @@ -550,8 +550,9 @@ apr_status_t h2_stream_set_request_rec(h2_stream *stream, } status = h2_request_rcreate(&req, stream->pool, r); if (status == APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(03058) - H2_STREAM_MSG(stream, "set_request_rec %s host=%s://%s%s"), + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, + H2_STRM_LOG(APLOGNO(03058), stream, + "set_request_rec %s host=%s://%s%s"), req->method, req->scheme, req->authority, req->path); stream->rtmp = req; /* simulate the frames that led to this */ @@ -592,8 +593,9 @@ static apr_status_t add_trailer(h2_stream *stream, char *hname, *hvalue; if (nlen == 0 || name[0] == ':') { - ap_log_cerror(APLOG_MARK, APLOG_DEBUG, APR_EINVAL, c, APLOGNO(03060) - H2_STREAM_MSG(stream, "pseudo header in trailer")); + ap_log_cerror(APLOG_MARK, APLOG_DEBUG, APR_EINVAL, c, + H2_STRM_LOG(APLOGNO(03060), stream, + "pseudo header in trailer")); return APR_EINVAL; } if (h2_req_ignore_trailer(name, nlen)) { @@ -626,14 +628,14 @@ apr_status_t h2_stream_add_header(h2_stream *stream, if ((vlen) > session->s->limit_req_line) { /* pseudo header: approximation of request line size check */ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - H2_STREAM_MSG(stream, "pseudo %s too long"), name); + H2_STRM_MSG(stream, "pseudo %s too long"), name); error = HTTP_REQUEST_URI_TOO_LARGE; } } else if ((nlen + 2 + vlen) > session->s->limit_req_fieldsize) { /* header too long */ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - H2_STREAM_MSG(stream, "header %s too long"), name); + H2_STRM_MSG(stream, "header %s too long"), name); error = HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE; } @@ -646,7 +648,7 @@ apr_status_t h2_stream_add_header(h2_stream *stream, return APR_ECONNRESET; } ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - H2_STREAM_MSG(stream, "too many header lines")); + H2_STRM_MSG(stream, "too many header lines")); error = HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE; } @@ -667,7 +669,7 @@ apr_status_t h2_stream_add_header(h2_stream *stream, } if (status != APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, - H2_STREAM_MSG(stream, "header %s not accepted"), name); + H2_STRM_MSG(stream, "header %s not accepted"), name); h2_stream_dispatch(stream, H2_SEV_CANCELLED); } return status; @@ -683,7 +685,7 @@ static apr_status_t fill_buffer(h2_stream *stream, apr_size_t amount) status = h2_beam_receive(stream->output, stream->out_buffer, APR_NONBLOCK_READ, amount); ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, stream->session->c, - H2_STREAM_MSG(stream, "beam_received")); + H2_STRM_MSG(stream, "beam_received")); return status; } @@ -795,18 +797,18 @@ apr_status_t h2_stream_out_prepare(h2_stream *stream, apr_off_t *plen, if (status == APR_SUCCESS) { if (presponse && *presponse) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, c, - H2_STREAM_MSG(stream, "prepare, response %d"), + H2_STRM_MSG(stream, "prepare, response %d"), (*presponse)->status); } else if (*peos || *plen) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, c, - H2_STREAM_MSG(stream, "prepare, len=%ld eos=%d"), + H2_STRM_MSG(stream, "prepare, len=%ld eos=%d"), (long)*plen, *peos); } else { status = APR_EAGAIN; ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, c, - H2_STREAM_MSG(stream, "prepare, no data")); + H2_STRM_MSG(stream, "prepare, no data")); } } return status; @@ -831,7 +833,7 @@ apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb, status = APR_EAGAIN; } ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, c, - H2_STREAM_MSG(stream, "read_to, len=%ld eos=%d"), + H2_STRM_MSG(stream, "read_to, len=%ld eos=%d"), (long)*plen, *peos); return status; } @@ -846,7 +848,7 @@ apr_status_t h2_stream_submit_pushes(h2_stream *stream, h2_headers *response) pushes = h2_push_collect_update(stream, stream->request, response); if (pushes && !apr_is_empty_array(pushes)) { ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, - H2_STREAM_MSG(stream, "found %d push candidates"), + H2_STRM_MSG(stream, "found %d push candidates"), pushes->nelts); for (i = 0; i < pushes->nelts; ++i) { h2_push *push = APR_ARRAY_IDX(pushes, i, h2_push*); diff --git a/modules/http2/h2_stream.h b/modules/http2/h2_stream.h index 33bbdd672e..c9466f29e1 100644 --- a/modules/http2/h2_stream.h +++ b/modules/http2/h2_stream.h @@ -272,8 +272,9 @@ const char *h2_stream_state_str(h2_stream *stream); int h2_stream_is_ready(h2_stream *stream); -#define H2_STREAM_MSG(s, msg) \ +#define H2_STRM_MSG(s, msg) \ "h2_stream(%ld-%d,%s): "msg, s->session->id, s->id, h2_stream_state_str(s) +#define H2_STRM_LOG(aplogno, s, msg) aplogno H2_STRM_MSG(s, msg) #endif /* defined(__mod_h2__h2_stream__) */ diff --git a/modules/http2/h2_task.c b/modules/http2/h2_task.c index 23439e3c1b..0190f8a889 100644 --- a/modules/http2/h2_task.c +++ b/modules/http2/h2_task.c @@ -480,38 +480,36 @@ static int h2_task_pre_conn(conn_rec* c, void *arg) return OK; } -h2_task *h2_task_create(conn_rec *c, int stream_id, const h2_request *req, - h2_bucket_beam *input, h2_bucket_beam *output, - h2_mplx *mplx) +h2_task *h2_task_create(h2_stream *stream, conn_rec *slave) { apr_pool_t *pool; h2_task *task; - ap_assert(mplx); - ap_assert(c); - ap_assert(req); + ap_assert(slave); + ap_assert(stream); + ap_assert(stream->request); - apr_pool_create(&pool, c->pool); + apr_pool_create(&pool, slave->pool); task = apr_pcalloc(pool, sizeof(h2_task)); if (task == NULL) { - ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_ENOMEM, c, - APLOGNO(02941) "h2_task(%ld-%d): create stream task", - c->id, stream_id); + ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_ENOMEM, slave, + H2_STRM_LOG(APLOGNO(02941), stream, "create task")); return NULL; } - task->id = apr_psprintf(pool, "%ld-%d", c->master->id, stream_id); - task->stream_id = stream_id; - task->c = c; - task->mplx = mplx; - task->c->keepalives = mplx->c->keepalives; + task->id = apr_psprintf(pool, "%ld-%d", + stream->session->id, stream->id); + task->stream_id = stream->id; + task->c = slave; + task->mplx = stream->session->mplx; + task->c->keepalives = slave->master->keepalives; task->pool = pool; - task->request = req; - task->input.beam = input; - task->output.beam = output; + task->request = stream->request; + task->input.beam = stream->input; + task->output.beam = stream->output; - h2_beam_send_from(output, task->pool); + h2_beam_send_from(stream->output, task->pool); apr_thread_cond_create(&task->cond, pool); - h2_ctx_create_for(c, task); + h2_ctx_create_for(slave, task); return task; } diff --git a/modules/http2/h2_task.h b/modules/http2/h2_task.h index a8f0f2c315..f004a4f92b 100644 --- a/modules/http2/h2_task.h +++ b/modules/http2/h2_task.h @@ -45,6 +45,7 @@ struct h2_task; struct h2_req_engine; struct h2_request; struct h2_response_parser; +struct h2_stream; struct h2_worker; typedef struct h2_task h2_task; @@ -91,11 +92,7 @@ struct h2_task { struct h2_req_engine *assigned; /* engine that task has been assigned to */ }; -h2_task *h2_task_create(conn_rec *c, int stream_id, - const struct h2_request *req, - struct h2_bucket_beam *input, - struct h2_bucket_beam *output, - struct h2_mplx *mplx); +h2_task *h2_task_create(struct h2_stream *stream, conn_rec *slave); void h2_task_destroy(h2_task *task);