]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: haterm: Don't init haterm master pipe if not used
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 19 May 2026 14:41:45 +0000 (16:41 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 19 May 2026 15:50:50 +0000 (17:50 +0200)
There is no reason to initialize the haterm master pipe if haterm is not
used. So now, it is only performed if a non-disabled haterm frontend is
found. To do so, in addition to test the proxy's flags and capabilities, we
also check if "stream_new_from_sc" points on "hstream_new".

src/haterm.c

index 2aefd0af12815a7e46b7eff4f070f0768731a0bd..d51d1bf4641541775a181299c3b6f159086989e3 100644 (file)
@@ -12,7 +12,7 @@
 #include <haproxy/istbuf.h>
 #include <haproxy/pipe.h>
 #include <haproxy/pool.h>
-#include <haproxy/proxy-t.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sc_strm.h>
 #include <haproxy/stconn-t.h>
 #include <haproxy/stream.h>
@@ -1223,11 +1223,22 @@ static int hstream_build_responses(void)
 #if defined(USE_LINUX_SPLICE)
 static void hstream_init_splicing(void)
 {
+       struct proxy *px;
        unsigned int pipesize = 65536;
+       int haterm_used = 0;
 
        if (!(global.tune.options & GTUNE_USE_SPLICE) || !global.maxpipes)
                return;
 
+       for (px = proxies_list; px; px = px->next) {
+               if ((px->cap & PR_CAP_FE) && !(px->flags & PR_FL_DISABLED) && px->stream_new_from_sc == hstream_new) {
+                       haterm_used = 1;
+                       break;
+               }
+       }
+       if (!haterm_used)
+               return;
+
        if (global.tune.pipesize)
                pipesize = global.tune.pipesize;