]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEBUG: stream-int: Fix BUG_ON used to test appctx in si_applet_ops callbacks
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Feb 2022 16:27:09 +0000 (17:27 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Feb 2022 16:29:11 +0000 (17:29 +0100)
693b23bb1 ("MEDIUM: tree-wide: Use unsafe conn-stream API when it is
relevant") introduced a regression in DEBUG_STRICT mode because some BUG_ON
conditions were inverted. It should ok now.

In addition, ALREADY_CHECKED macro was removed from appctx_wakeup() function
because it is useless now.

include/haproxy/applet.h
src/stream_interface.c

index b4c33ea26f89ee6fdff2116e2f32c185c3e6c6a1..97b9c347b4fe55530a2c92d46ccf0f6b31a51484 100644 (file)
@@ -113,8 +113,6 @@ static inline void appctx_free(struct appctx *appctx)
 /* wakes up an applet when conditions have changed */
 static inline void appctx_wakeup(struct appctx *appctx)
 {
-       ALREADY_CHECKED(appctx);
-
        task_wakeup(appctx->t, TASK_WOKEN_OTHER);
 }
 
index c5112dfe583d872101f186679eb066499e3f90d9..35f66d749c38ae85ce7662d1a0e0196c77510890 100644 (file)
@@ -1656,7 +1656,7 @@ void si_applet_wake_cb(struct stream_interface *si)
 {
        struct channel *ic = si_ic(si);
 
-       BUG_ON(cs_appctx(si->cs));
+       BUG_ON(!cs_appctx(si->cs));
 
        /* If the applet wants to write and the channel is closed, it's a
         * broken pipe and it must be reported.
@@ -1696,7 +1696,7 @@ static void stream_int_shutr_applet(struct stream_interface *si)
 {
        struct channel *ic = si_ic(si);
 
-       BUG_ON(cs_appctx(si->cs));
+       BUG_ON(!cs_appctx(si->cs));
 
        si_rx_shut_blk(si);
        if (ic->flags & CF_SHUTR)
@@ -1732,7 +1732,7 @@ static void stream_int_shutw_applet(struct stream_interface *si)
        struct channel *ic = si_ic(si);
        struct channel *oc = si_oc(si);
 
-       BUG_ON(cs_appctx(si->cs));
+       BUG_ON(!cs_appctx(si->cs));
 
        oc->flags &= ~CF_SHUTW_NOW;
        if (oc->flags & CF_SHUTW)
@@ -1785,7 +1785,7 @@ static void stream_int_chk_rcv_applet(struct stream_interface *si)
 {
        struct channel *ic = si_ic(si);
 
-       BUG_ON(cs_appctx(si->cs));
+       BUG_ON(!cs_appctx(si->cs));
 
        DPRINTF(stderr, "%s: si=%p, si->state=%d ic->flags=%08x oc->flags=%08x\n",
                __FUNCTION__,
@@ -1802,7 +1802,7 @@ static void stream_int_chk_snd_applet(struct stream_interface *si)
 {
        struct channel *oc = si_oc(si);
 
-       BUG_ON(cs_appctx(si->cs));
+       BUG_ON(!cs_appctx(si->cs));
 
        DPRINTF(stderr, "%s: si=%p, si->state=%d ic->flags=%08x oc->flags=%08x\n",
                __FUNCTION__,