diff --git a/include/haproxy/hldstream.h b/include/haproxy/hldstream.h new file mode 100644 index 000000000..2e05922c4 --- /dev/null +++ b/include/haproxy/hldstream.h @@ -0,0 +1,8 @@ +#ifndef _HAPROXY_HLDSTREAM_H +#define _HAPROXY_HLDSTREAM_H + +#include + +struct task *hld_io_cb(struct task *t, void *context, unsigned int state); + +#endif /* _HAPROXY_HLDSTREAM_H */ diff --git a/src/stconn.c b/src/stconn.c index 8be03f144..f96ca0ba4 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -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;