changeset 6764:edffb7defebe stable-1.10

HTTP/2: refactored ngx_http_v2_send_output_queue(). Now it returns NGX_AGAIN if there's still data to be sent.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 19 Jul 2016 20:34:02 +0300
parents 4f8ad0faab3c
children 85c3740b6745
files src/http/v2/ngx_http_v2.c
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -478,7 +478,7 @@ ngx_http_v2_send_output_queue(ngx_http_v
     wev = c->write;
 
     if (!wev->ready) {
-        return NGX_OK;
+        return NGX_AGAIN;
     }
 
     cl = NULL;
@@ -549,15 +549,6 @@ ngx_http_v2_send_output_queue(ngx_http_v
         c->tcp_nodelay = NGX_TCP_NODELAY_SET;
     }
 
-    if (!wev->ready) {
-        ngx_add_timer(wev, clcf->send_timeout);
-
-    } else {
-        if (wev->timer_set) {
-            ngx_del_timer(wev);
-        }
-    }
-
     for ( /* void */ ; out; out = fn) {
         fn = out->next;
 
@@ -582,6 +573,15 @@ ngx_http_v2_send_output_queue(ngx_http_v
 
     h2c->last_out = frame;
 
+    if (!wev->ready) {
+        ngx_add_timer(wev, clcf->send_timeout);
+        return NGX_AGAIN;
+    }
+
+    if (wev->timer_set) {
+        ngx_del_timer(wev);
+    }
+
     return NGX_OK;
 
 error: