From: Stefan Eissing Date: Tue, 23 Feb 2016 19:12:31 +0000 (+0000) Subject: improved eos out handling on streams X-Git-Tag: 2.5.0-alpha~2027 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79a2040865f74d6155716e4aba9dd55c2fffa959;p=thirdparty%2Fapache%2Fhttpd.git improved eos out handling on streams git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1731931 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_io.c b/modules/http2/h2_io.c index 97ba08510bd..f88ac4d8804 100644 --- a/modules/http2/h2_io.c +++ b/modules/http2/h2_io.c @@ -308,7 +308,7 @@ apr_status_t h2_io_out_readx(h2_io *io, return APR_ECONNABORTED; } - if (io->eos_out) { + if (io->eos_out_read) { *plen = 0; *peos = 1; return APR_SUCCESS; @@ -326,7 +326,7 @@ apr_status_t h2_io_out_readx(h2_io *io, else { status = h2_util_bb_readx(io->bbout, cb, ctx, plen, peos); if (status == APR_SUCCESS) { - io->eos_out = *peos; + io->eos_out_read = *peos; } } @@ -340,7 +340,7 @@ apr_status_t h2_io_out_read_to(h2_io *io, apr_bucket_brigade *bb, return APR_ECONNABORTED; } - if (io->eos_out) { + if (io->eos_out_read) { *plen = 0; *peos = 1; return APR_SUCCESS; @@ -351,7 +351,7 @@ apr_status_t h2_io_out_read_to(h2_io *io, apr_bucket_brigade *bb, return APR_EAGAIN; } - io->eos_out = *peos = h2_util_has_eos(io->bbout, *plen); + io->eos_out_read = *peos = h2_util_has_eos(io->bbout, *plen); return h2_util_move(bb, io->bbout, *plen, NULL, "h2_io_read_to"); } @@ -423,14 +423,17 @@ apr_status_t h2_io_out_close(h2_io *io, apr_table_t *trailers) if (io->rst_error) { return APR_ECONNABORTED; } - if (!io->eos_out) { /* EOS has not been read yet */ + if (!io->eos_out_read) { /* EOS has not been read yet */ process_trailers(io, trailers); if (!io->bbout) { io->bbout = apr_brigade_create(io->pool, io->bucket_alloc); } - if (!h2_util_has_eos(io->bbout, -1)) { - APR_BRIGADE_INSERT_TAIL(io->bbout, - apr_bucket_eos_create(io->bucket_alloc)); + if (!io->eos_out) { + io->eos_out = 1; + if (!h2_util_has_eos(io->bbout, -1)) { + APR_BRIGADE_INSERT_TAIL(io->bbout, + apr_bucket_eos_create(io->bucket_alloc)); + } } } return APR_SUCCESS; diff --git a/modules/http2/h2_io.h b/modules/http2/h2_io.h index 6b126d70aa2..7c704a4d8eb 100644 --- a/modules/http2/h2_io.h +++ b/modules/http2/h2_io.h @@ -54,7 +54,8 @@ struct h2_io { unsigned int request_body : 1; /* iff request has body */ unsigned int eos_in : 1; /* input eos has been seen */ unsigned int eos_in_written : 1; /* input eos has been forwarded */ - unsigned int eos_out : 1; /* output eos has been seen */ + unsigned int eos_out : 1; /* output eos is present */ + unsigned int eos_out_read : 1; /* output eos has been forwarded */ h2_io_op timed_op; /* which operation is waited on, if any */ struct apr_thread_cond_t *timed_cond; /* condition to wait on, maybe NULL */