]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sink: don't rely on forward_px to init sink forwarding
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 18 Sep 2023 15:21:19 +0000 (17:21 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Oct 2023 13:34:31 +0000 (15:34 +0200)
Instead, we check if at least one sft has been registered into the sink,
if it is the case, then we need to init the forwarding for the sink.

src/sink.c

index a75cb7ed2bb04114311eafba324fe21b43f3924a..ae64b5537cc2bfa80ceeb12dd5e1a1d416de2574 100644 (file)
@@ -894,10 +894,11 @@ static int sink_finalize(struct sink *sink)
                                sink->sft = sft;
                                srv = srv->next;
                        }
-                       if (sink_init_forward(sink) == 0) {
-                               ha_alert("error when trying to initialize sink buffer forwarding.\n");
-                               err_code |= ERR_ALERT | ERR_FATAL;
-                       }
+               }
+               /* init forwarding if at least one sft is registered */
+               if (sink->sft && sink_init_forward(sink) == 0) {
+                       ha_alert("error when trying to initialize sink buffer forwarding.\n");
+                       err_code |= ERR_ALERT | ERR_FATAL;
                }
        }
        return err_code;