]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: always handle streams in error state.
authorValentin Bartenev <vbart@nginx.com>
Tue, 19 Jul 2016 17:22:44 +0000 (20:22 +0300)
committerValentin Bartenev <vbart@nginx.com>
Tue, 19 Jul 2016 17:22:44 +0000 (20:22 +0300)
Previously, a stream could be closed by timeout if it was canceled
while its send window was exhausted.

src/http/v2/ngx_http_v2_filter_module.c

index 8b9153801f7f283618617594760ba93e43acef8e..09ce3f65e78e9ca1bf8e03244fdd5328cc235854 100644 (file)
@@ -1317,18 +1317,20 @@ static ngx_inline void
 ngx_http_v2_handle_stream(ngx_http_v2_connection_t *h2c,
     ngx_http_v2_stream_t *stream)
 {
-    ngx_event_t  *wev;
+    ngx_connection_t  *fc;
 
-    if (stream->handled || stream->blocked || stream->exhausted) {
+    if (stream->handled || stream->blocked) {
         return;
     }
 
-    wev = stream->request->connection->write;
+    fc = stream->request->connection;
 
-    if (!wev->delayed) {
-        stream->handled = 1;
-        ngx_queue_insert_tail(&h2c->posted, &stream->queue);
+    if (!fc->error && (stream->exhausted || fc->write->delayed)) {
+        return;
     }
+
+    stream->handled = 1;
+    ngx_queue_insert_tail(&h2c->posted, &stream->queue);
 }