]> granicus.if.org Git - apache/commitdiff
adding flush bucket on every main connection buffer flushes
authorStefan Eissing <icing@apache.org>
Tue, 9 Feb 2016 19:17:45 +0000 (19:17 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 9 Feb 2016 19:17:45 +0000 (19:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729439 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_conn_io.c
modules/http2/h2_io.h
modules/http2/h2_mplx.c

index ed31352d3d473b549895d852a0821b46ac892902..1d6d73e088c710e61ecb5d0eb8413cd63118f6dd 100644 (file)
@@ -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;
+}
+
index e557636443364823b12e6a51899ec1f421efeaa3..5957feddc755a29e0b835db028f5c0d53218042e 100644 (file)
@@ -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 */
index 21fb0864e05459ebf5f28e9af0120756979dd90a..3c4d219197dac7e5d872be88f1df09a2baf7e129 100644 (file)
@@ -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 {