]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Don't wakeup applet for send if it won't consume data
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Jun 2022 15:35:34 +0000 (17:35 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 13 Jun 2022 12:26:13 +0000 (14:26 +0200)
in .chk_snd applet callback function, we must not wake up an applet if
SE_FL_WONT_CONSUME flag is set. Indeed, if an applet explicitly specify it
will not consume any outgoing data, it is useless to wake it up when more
data are sent. Note the applet may still be woken up for another reason. In
this case SE_FL_WONT_CONSUME flag will be removed. It is the applet
responsibility to set it again, if necessary.

This patch must be backported to 2.6 after an observation period. On earlier
versions, the bug probably exists too. However, because a massive
refactoring was performed in 2.6, the patch will have to be adapted and
carefully reviewed/tested if it is backported..

src/stconn.c

index 28f77ecb86f0b2f15e2488653d0b068056290f92..5d4ed3ed47c5c523312d290770a1ac5c61a0e025 100644 (file)
@@ -981,9 +981,8 @@ static void sc_app_chk_snd_applet(struct stconn *sc)
        if (unlikely(sc->state != SC_ST_EST || (oc->flags & CF_SHUTW)))
                return;
 
-       /* we only wake the applet up if it was waiting for some data */
-
-       if (!sc_ep_test(sc, SE_FL_WAIT_DATA))
+       /* we only wake the applet up if it was waiting for some data  and is ready to consume it */
+       if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || sc_ep_test(sc, SE_FL_WONT_CONSUME))
                return;
 
        if (!tick_isset(oc->wex))