]> git.kaiwu.me - haproxy.git/commitdiff
WIP: stconn: modify sc_attach_mux() to support haload streams
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 16 Apr 2026 06:00:23 +0000 (08:00 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Tue, 5 May 2026 17:51:33 +0000 (19:51 +0200)
include/haproxy/hldstream.h [new file with mode: 0644]
src/stconn.c

diff --git a/include/haproxy/hldstream.h b/include/haproxy/hldstream.h
new file mode 100644 (file)
index 0000000..2e05922
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _HAPROXY_HLDSTREAM_H
+#define _HAPROXY_HLDSTREAM_H
+
+#include <haproxy/hldstream-t.h>
+
+struct task *hld_io_cb(struct task *t, void *context, unsigned int state);
+
+#endif /* _HAPROXY_HLDSTREAM_H */
index 8be03f14436af7005cef9d87dc9e164d2e766a29..f96ca0ba4eea9000611620ac68536f3fb4ce351f 100644 (file)
@@ -17,6 +17,7 @@
 #include <haproxy/check.h>
 #include <haproxy/filters.h>
 #include <haproxy/hstream.h>
+#include <haproxy/hldstream.h>
 #include <haproxy/http_ana.h>
 #include <haproxy/pipe.h>
 #include <haproxy/pool.h>
@@ -31,6 +32,8 @@ DECLARE_TYPED_POOL(pool_head_sedesc, "sedesc", struct sedesc);
 
 static int sc_conn_recv(struct stconn *sc);
 static int sc_conn_send(struct stconn *sc);
+extern __attribute__((weak))
+struct task *hld_io_cb(struct task *t, void *context, unsigned int state);
 
 /* Initializes an endpoint */
 void sedesc_init(struct sedesc *sedesc)
@@ -298,6 +301,16 @@ int sc_attach_mux(struct stconn *sc, void *sd, void *ctx)
                        sc->wait_event.events = 0;
                }
        }
+       else if (sc_hldstream(sc)) {
+               if (!sc->wait_event.tasklet) {
+                       sc->wait_event.tasklet = tasklet_new();
+                       if (!sc->wait_event.tasklet)
+                               return -1;
+                       sc->wait_event.tasklet->process = hld_io_cb;
+                       sc->wait_event.tasklet->context = sc;
+                       sc->wait_event.events = 0;
+               }
+       }
 
        sedesc->se = sd;
        sedesc->conn = ctx;