Don't delete timer of write event when it's delayed.

Jiuzhou Cui jiuzhoucui at 163.com
Wed Dec 27 02:56:44 UTC 2023


Hello!


# HG changeset patch
# User Jiuzhou Cui <cuijiuzhou at alibaba-inc.com>
# Date 1703645578 -28800
#      Wed Dec 27 10:52:58 2023 +0800
# Node ID 474ae07e47272e435d81c0ca9e4867aae35c30ab
# Parent  ee40e2b1d0833b46128a357fbc84c6e23be9be07
Don't delete timer of write event when it's delayed.


This will make download speed alway zero when limit_rate in body filter.


diff -r ee40e2b1d083 -r 474ae07e4727 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c      Mon Dec 25 21:15:48 2023 +0400
+++ b/src/http/ngx_http_upstream.c      Wed Dec 27 10:52:58 2023 +0800
@@ -3787,11 +3787,13 @@
         }
     }


-    if (downstream->write->active && !downstream->write->ready) {
-        ngx_add_timer(downstream->write, clcf->send_timeout);
-
-    } else if (downstream->write->timer_set) {
-        ngx_del_timer(downstream->write);
+    if (!downstream->write->delayed) {
+        if (downstream->write->active && !downstream->write->ready) {
+            ngx_add_timer(downstream->write, clcf->send_timeout);
+
+        } else if (downstream->write->timer_set) {
+            ngx_del_timer(downstream->write);
+        }
     }


     if (upstream->read->eof || upstream->read->error) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20231227/2feb038d/attachment.htm>


More information about the nginx-devel mailing list