]> granicus.if.org Git - apache/commitdiff
improved eos out handling on streams
authorStefan Eissing <icing@apache.org>
Tue, 23 Feb 2016 19:12:31 +0000 (19:12 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 23 Feb 2016 19:12:31 +0000 (19:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1731931 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_io.c
modules/http2/h2_io.h

index 97ba08510bdcb74d0823248f7a0ba61421555b11..f88ac4d88042def409081aeb00bfe6d7b1cea21f 100644 (file)
@@ -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;
index 6b126d70aa26c14c7267da7800702fbb345eb8d2..7c704a4d8eba76992c88aaba6d36eea07a9b22e4 100644 (file)
@@ -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 */