diff options
author | Stefan Eissing <icing@apache.org> | 2022-03-21 10:38:05 +0000 |
---|---|---|
committer | Stefan Eissing <icing@apache.org> | 2022-03-21 10:38:05 +0000 |
commit | 4407147f0239c67fa87cacfba33bae073800f4cf (patch) | |
tree | f957b85bec8b1bdf5b0b2e97b36bd7cf5503c832 /modules/http2 | |
parent | 5b44e011362830de3fee365eca770f6ab0a4ab79 (diff) | |
download | httpd-4407147f0239c67fa87cacfba33bae073800f4cf.tar.gz |
*) mod_http2: when using a pipe for input signalling, always
write to it on sending buckets, not only when it was empty.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899108 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2')
-rw-r--r-- | modules/http2/h2_bucket_beam.c | 18 | ||||
-rw-r--r-- | modules/http2/h2_bucket_beam.h | 13 | ||||
-rw-r--r-- | modules/http2/h2_mplx.c | 3 |
3 files changed, 33 insertions, 1 deletions
diff --git a/modules/http2/h2_bucket_beam.c b/modules/http2/h2_bucket_beam.c index c0968b6d93..6ac85a5e95 100644 --- a/modules/http2/h2_bucket_beam.c +++ b/modules/http2/h2_bucket_beam.c @@ -387,6 +387,9 @@ void h2_beam_abort(h2_bucket_beam *beam, conn_rec *c) beam->aborted = 1; if (c == beam->from) { /* sender aborts */ + if (beam->send_cb) { + beam->send_cb(beam->send_ctx, beam); + } if (beam->was_empty_cb && buffer_is_empty(beam)) { beam->was_empty_cb(beam->was_empty_ctx, beam); } @@ -542,6 +545,9 @@ apr_status_t h2_beam_send(h2_bucket_beam *beam, conn_rec *from, * Trigger event callbacks, so receiver can know there is something * to receive before we do a conditional wait. */ purge_consumed_buckets(beam); + if (beam->send_cb) { + beam->send_cb(beam->send_ctx, beam); + } if (was_empty && beam->was_empty_cb) { beam->was_empty_cb(beam->was_empty_ctx, beam); } @@ -553,6 +559,9 @@ apr_status_t h2_beam_send(h2_bucket_beam *beam, conn_rec *from, } } + if (beam->send_cb && !buffer_is_empty(beam)) { + beam->send_cb(beam->send_ctx, beam); + } if (was_empty && beam->was_empty_cb && !buffer_is_empty(beam)) { beam->was_empty_cb(beam->was_empty_ctx, beam); } @@ -760,6 +769,15 @@ void h2_beam_on_received(h2_bucket_beam *beam, apr_thread_mutex_unlock(beam->lock); } +void h2_beam_on_send(h2_bucket_beam *beam, + h2_beam_ev_callback *send_cb, void *ctx) +{ + apr_thread_mutex_lock(beam->lock); + beam->send_cb = send_cb; + beam->send_ctx = ctx; + apr_thread_mutex_unlock(beam->lock); +} + void h2_beam_on_was_empty(h2_bucket_beam *beam, h2_beam_ev_callback *was_empty_cb, void *ctx) { diff --git a/modules/http2/h2_bucket_beam.h b/modules/http2/h2_bucket_beam.h index b6847733e3..dced250dba 100644 --- a/modules/http2/h2_bucket_beam.h +++ b/modules/http2/h2_bucket_beam.h @@ -65,6 +65,8 @@ struct h2_bucket_beam { void *was_empty_ctx; h2_beam_ev_callback *recv_cb; /* event: buckets were transfered in h2_beam_receive() */ void *recv_ctx; + h2_beam_ev_callback *send_cb; /* event: buckets were added in h2_beam_send() */ + void *send_ctx; apr_off_t recv_bytes; /* amount of bytes transferred in h2_beam_receive() */ apr_off_t recv_bytes_reported; /* amount of bytes reported as received via callback */ @@ -197,6 +199,17 @@ void h2_beam_on_received(h2_bucket_beam *beam, /** * Register a call back from the sender side to be invoked when send + * has added buckets to the beam. + * Unregister by passing a NULL on_send_cb. + * @param beam the beam to set the callback on + * @param on_send_cb the callback to invoke after buckets were added + * @param ctx the context to use in callback invocation + */ +void h2_beam_on_send(h2_bucket_beam *beam, + h2_beam_ev_callback *on_send_cb, void *ctx); + +/** + * Register a call back from the sender side to be invoked when send * has added to a previously empty beam. * Unregister by passing a NULL was_empty_cb. * @param beam the beam to set the callback on diff --git a/modules/http2/h2_mplx.c b/modules/http2/h2_mplx.c index 1f1b31d240..28315d76a6 100644 --- a/modules/http2/h2_mplx.c +++ b/modules/http2/h2_mplx.c @@ -139,6 +139,7 @@ static void m_stream_cleanup(h2_mplx *m, h2_stream *stream) h2_beam_on_was_empty(c2_ctx->beam_out, NULL, NULL); } if (c2_ctx->beam_in) { + h2_beam_on_send(c2_ctx->beam_in, NULL, NULL); h2_beam_on_received(c2_ctx->beam_in, NULL, NULL); h2_beam_on_consumed(c2_ctx->beam_in, NULL, NULL); } @@ -796,7 +797,7 @@ static apr_status_t c2_setup_io(h2_mplx *m, conn_rec *c2, h2_stream *stream, h2_ if (stream->input) { conn_ctx->beam_in = stream->input; - h2_beam_on_was_empty(stream->input, c2_beam_input_write_notify, c2); + h2_beam_on_send(stream->input, c2_beam_input_write_notify, c2); h2_beam_on_received(stream->input, c2_beam_input_read_notify, c2); h2_beam_on_consumed(stream->input, c1_input_consumed, stream); } |