]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream: don't abusively loop back on changes on CF_SHUT*_NOW
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Jun 2019 12:45:26 +0000 (14:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Jun 2019 14:36:19 +0000 (16:36 +0200)
These flags are not used by analysers, only by the shut* functions, and
they were covered by CF_MASK_STATIC only because in the past the shut
functions were in the middle of the analysers. But here they are causing
excess loop backs which provide no value and increase processing cost.
Ideally the CF_MASK_STATIC bitfield should be revisited, but doing this
alone is enough to reduce by 30% the number of calls to si_sync_send().

src/stream.c

index 860f2fdd2c324f55092ed21c7278ad03764f1993..e536ee2ef8c1d2f26b1b33466cd84a888bdc335f 100644 (file)
@@ -2144,7 +2144,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                req->flags &= ~CF_WAKE_ONCE;
                rqf_last = req->flags;
 
-               if ((req->flags ^ flags) & CF_MASK_STATIC)
+               if ((req->flags ^ flags) & (CF_SHUTR|CF_SHUTW))
                        goto resync_request;
        }
 
@@ -2213,7 +2213,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                res->flags &= ~CF_WAKE_ONCE;
                rpf_last = res->flags;
 
-               if ((res->flags ^ flags) & CF_MASK_STATIC)
+               if ((res->flags ^ flags) & (CF_SHUTR|CF_SHUTW))
                        goto resync_response;
        }
 
@@ -2500,7 +2500,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                goto resync_stream_interface;
 
        /* otherwise we want to check if we need to resync the req buffer or not */
-       if ((req->flags ^ rqf_last) & CF_MASK_STATIC)
+       if ((req->flags ^ rqf_last) & (CF_SHUTR|CF_SHUTW))
                goto resync_request;
 
        /* perform output updates to the response buffer */