From 6b651994406ecbead31d2f9f3bb255ba22ec7c34 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Sun, 30 Jul 2017 18:54:15 +0000 Subject: [PATCH] mod_http2: signalling produce IO before waiting on beam buffer to drain. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1803454 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http2/h2_bucket_beam.c | 17 ++++++++++------- modules/http2/h2_version.h | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/http2/h2_bucket_beam.c b/modules/http2/h2_bucket_beam.c index fc2b723072..9f3bc70911 100644 --- a/modules/http2/h2_bucket_beam.c +++ b/modules/http2/h2_bucket_beam.c @@ -367,7 +367,7 @@ static apr_status_t wait_not_empty(h2_bucket_beam *beam, apr_read_type_e block, } static apr_status_t wait_not_full(h2_bucket_beam *beam, apr_read_type_e block, - apr_size_t *pspace_left, apr_thread_mutex_t *lock) + apr_size_t *pspace_left, h2_beam_lock *bl) { apr_status_t rv = APR_SUCCESS; apr_size_t left; @@ -376,14 +376,16 @@ static apr_status_t wait_not_full(h2_bucket_beam *beam, apr_read_type_e block, if (beam->aborted) { rv = APR_ECONNABORTED; } - else if (block != APR_BLOCK_READ) { + else if (block != APR_BLOCK_READ || !bl->mutex) { rv = APR_EAGAIN; } - else if (beam->timeout > 0) { - rv = apr_thread_cond_timedwait(beam->change, lock, beam->timeout); - } else { - rv = apr_thread_cond_wait(beam->change, lock); + if (beam->timeout > 0) { + rv = apr_thread_cond_timedwait(beam->change, bl->mutex, beam->timeout); + } + else { + rv = apr_thread_cond_wait(beam->change, bl->mutex); + } } } *pspace_left = left; @@ -944,7 +946,8 @@ apr_status_t h2_beam_send(h2_bucket_beam *beam, space_left = calc_space_left(beam); while (!APR_BRIGADE_EMPTY(sender_bb) && APR_SUCCESS == rv) { if (space_left <= 0) { - rv = wait_not_full(beam, block, &space_left, bl.mutex); + report_prod_io(beam, force_report, &bl); + rv = wait_not_full(beam, block, &space_left, &bl); if (APR_SUCCESS != rv) { break; } diff --git a/modules/http2/h2_version.h b/modules/http2/h2_version.h index 0fdb26395f..ac029bbe6b 100644 --- a/modules/http2/h2_version.h +++ b/modules/http2/h2_version.h @@ -26,7 +26,7 @@ * @macro * Version number of the http2 module as c string */ -#define MOD_HTTP2_VERSION "1.10.9-DEV" +#define MOD_HTTP2_VERSION "1.10.10-DEV" /** * @macro @@ -34,7 +34,7 @@ * release. This is a 24 bit number with 8 bits for major number, 8 bits * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. */ -#define MOD_HTTP2_VERSION_NUM 0x010a09 +#define MOD_HTTP2_VERSION_NUM 0x010a0a #endif /* mod_h2_h2_version_h */ -- 2.40.0