From: Stefan Eissing Date: Tue, 9 Feb 2016 19:17:45 +0000 (+0000) Subject: adding flush bucket on every main connection buffer flushes X-Git-Tag: 2.5.0-alpha~2159 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=efa6237417aa1ebb180c4bd17d7b56492234df4f;p=apache adding flush bucket on every main connection buffer flushes git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729439 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_conn_io.c b/modules/http2/h2_conn_io.c index ed31352d3d..1d6d73e088 100644 --- a/modules/http2/h2_conn_io.c +++ b/modules/http2/h2_conn_io.c @@ -171,56 +171,6 @@ static apr_status_t bucketeer_buffer(h2_conn_io *io) return APR_SUCCESS; } -apr_status_t h2_conn_io_write(h2_conn_io *io, - const char *buf, size_t length) -{ - apr_status_t status = APR_SUCCESS; - pass_out_ctx ctx; - - ctx.c = io->connection; - ctx.io = io; - io->unflushed = 1; - if (io->bufsize > 0) { - ap_log_cerror(APLOG_MARK, APLOG_TRACE4, 0, io->connection, - "h2_conn_io: buffering %ld bytes", (long)length); - - if (!APR_BRIGADE_EMPTY(io->output)) { - status = h2_conn_io_pass(io); - io->unflushed = 1; - } - - while (length > 0 && (status == APR_SUCCESS)) { - apr_size_t avail = io->bufsize - io->buflen; - if (avail <= 0) { - - bucketeer_buffer(io); - status = pass_out(io->output, &ctx); - io->buflen = 0; - } - else if (length > avail) { - memcpy(io->buffer + io->buflen, buf, avail); - io->buflen += avail; - length -= avail; - buf += avail; - } - else { - memcpy(io->buffer + io->buflen, buf, length); - io->buflen += length; - length = 0; - break; - } - } - - } - else { - ap_log_cerror(APLOG_MARK, APLOG_TRACE4, status, io->connection, - "h2_conn_io: writing %ld bytes to brigade", (long)length); - status = apr_brigade_write(io->output, pass_out, &ctx, buf, length); - } - - return status; -} - apr_status_t h2_conn_io_writeb(h2_conn_io *io, apr_bucket *b) { APR_BRIGADE_INSERT_TAIL(io->output, b); @@ -300,3 +250,50 @@ apr_status_t h2_conn_io_pass(h2_conn_io *io) return h2_conn_io_flush_int(io, 0, 0); } +apr_status_t h2_conn_io_write(h2_conn_io *io, + const char *buf, size_t length) +{ + apr_status_t status = APR_SUCCESS; + pass_out_ctx ctx; + + ctx.c = io->connection; + ctx.io = io; + io->unflushed = 1; + if (io->bufsize > 0) { + ap_log_cerror(APLOG_MARK, APLOG_TRACE4, 0, io->connection, + "h2_conn_io: buffering %ld bytes", (long)length); + + if (!APR_BRIGADE_EMPTY(io->output)) { + status = h2_conn_io_pass(io); + io->unflushed = 1; + } + + while (length > 0 && (status == APR_SUCCESS)) { + apr_size_t avail = io->bufsize - io->buflen; + if (avail <= 0) { + h2_conn_io_flush_int(io, 1, 0); + } + else if (length > avail) { + memcpy(io->buffer + io->buflen, buf, avail); + io->buflen += avail; + length -= avail; + buf += avail; + } + else { + memcpy(io->buffer + io->buflen, buf, length); + io->buflen += length; + length = 0; + break; + } + } + + } + else { + ap_log_cerror(APLOG_MARK, APLOG_TRACE4, status, io->connection, + "h2_conn_io: writing %ld bytes to brigade", (long)length); + status = apr_brigade_write(io->output, pass_out, &ctx, buf, length); + } + + return status; +} + diff --git a/modules/http2/h2_io.h b/modules/http2/h2_io.h index e557636443..5957feddc7 100644 --- a/modules/http2/h2_io.h +++ b/modules/http2/h2_io.h @@ -48,8 +48,8 @@ struct h2_io { apr_bucket_brigade *tmp; /* temporary data for chunking */ unsigned int orphaned : 1; /* h2_stream is gone for this io */ - unsigned int worker_started : 1; /* h2_worker started processing for this io */ - unsigned int worker_done : 1; /* h2_worker finished for this io */ + unsigned int processing_started : 1; /* h2_worker started processing for this io */ + unsigned int processing_done: 1; /* h2_worker finished for this 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 */ diff --git a/modules/http2/h2_mplx.c b/modules/http2/h2_mplx.c index 21fb0864e0..3c4d219197 100644 --- a/modules/http2/h2_mplx.c +++ b/modules/http2/h2_mplx.c @@ -291,7 +291,7 @@ static int io_stream_done(h2_mplx *m, h2_io *io, int rst_error) { /* Remove io from ready set, we will never submit it */ h2_io_set_remove(m->ready_ios, io); - if (!io->worker_started || io->worker_done) { + if (!io->processing_started || io->processing_done) { /* already finished or not even started yet */ h2_tq_remove(m->q, io->id); io_destroy(m, io, 1); @@ -406,7 +406,7 @@ static const h2_request *pop_request(h2_mplx *m) h2_io *io = h2_io_set_get(m->stream_ios, sid); if (io) { req = io->request; - io->worker_started = 1; + io->processing_started = 1; if (sid > m->max_stream_started) { m->max_stream_started = sid; } @@ -425,7 +425,7 @@ void h2_mplx_request_done(h2_mplx **pm, int stream_id, const h2_request **preq) ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c, "h2_mplx(%ld): request(%d) done", m->id, stream_id); if (io) { - io->worker_done = 1; + io->processing_done = 1; if (io->orphaned) { io_destroy(m, io, 0); if (m->join_wait) { @@ -672,7 +672,7 @@ h2_stream *h2_mplx_next_submit(h2_mplx *m, h2_stream_set *streams) "resetting io to close request processing", m->id, io->id); h2_io_make_orphaned(io, H2_ERR_STREAM_CLOSED); - if (!io->worker_started || io->worker_done) { + if (!io->processing_started || io->processing_done) { io_destroy(m, io, 1); } else {