to be merged into haload sources commit:
Some checks failed
Contrib / admin/halog/ (push) Has been cancelled
Contrib / dev/flags/ (push) Has been cancelled
Contrib / dev/haring/ (push) Has been cancelled
Contrib / dev/hpack/ (push) Has been cancelled
Contrib / dev/poll/ (push) Has been cancelled
VTest / Generate Build Matrix (push) Has been cancelled
Windows / Windows, gcc, all features (push) Has been cancelled
VTest / (push) Has been cancelled

get rid of an intermediary task (hld_io_cb) between the muxes and the haload
stream task handler (hld_strm_task()).
This commit is contained in:
Frederic Lecaille 2026-05-22 15:59:11 +02:00
parent 7e877b8349
commit efc5ed1bf2
2 changed files with 20 additions and 34 deletions

View file

@ -6,7 +6,6 @@
#include <haproxy/http.h>
#include <haproxy/http_htx.h>
#include <haproxy/htx.h>
#include <haproxy/hldstream.h>
#include <haproxy/haload.h>
#include <haproxy/proxy.h>
#include <haproxy/task.h>
@ -1142,32 +1141,6 @@ static void hldstream_htx_buf_rcv(struct connection *conn,
TRACE_LEAVE(HLD_STRM_EV_RX, hs);
}
/* I/O handler wakeup from MUX */
struct task *hld_io_cb(struct task *t, void *context, unsigned int state)
{
struct stconn *sc = context;
struct hldstream *hs = __sc_hldstream(sc);
struct connection *conn; //= hs ? sc_conn(hs->sc) : NULL;
TRACE_ENTER(HLD_STRM_EV_TASK, hs);
sc = hs->sc;
conn = sc_conn(sc);
if (sc_ep_test(sc, SE_FL_ERROR) || (conn && (conn->flags & CO_FL_ERROR))) {
TRACE_ERROR("connection error", HLD_STRM_EV_IO_CB, hs);
hs->flags |= HLD_STRM_ST_CONN_ERR;
task_wakeup(hs->task, TASK_WOKEN_IO);
goto err;
}
leave:
task_wakeup(hs->task, TASK_WOKEN_IO);
TRACE_LEAVE(HLD_STRM_EV_TASK, hs);
return t;
err:
TRACE_DEVEL("leaving on error", HLD_STRM_EV_TASK, hs);
goto leave;
}
static void hld_conn_destroy(struct connection *conn)
{
TRACE_ENTER(HLD_STRM_EV_TASK);
@ -1213,7 +1186,8 @@ static int hld_be_reuse_conn(struct connection **conn, int64_t *hash,
return ret;
}
static struct task *hld_strm_task(struct task *t, void *context, unsigned int state)
/* haload stream task handler */
struct task *hld_strm_task(struct task *t, void *context, unsigned int state)
{
struct hldstream *hs = context;
struct hld_usr *usr = hs->usr;
@ -1221,12 +1195,7 @@ static struct task *hld_strm_task(struct task *t, void *context, unsigned int st
struct connection *conn = sc_conn(hs->sc);
struct session *sess = usr->sess;
struct server *srv = url->cfg->srv;
__attribute__((unused))
int ret, fin = 0;
__attribute__((unused))
int64_t hash;
__attribute__((unused))
struct sockaddr_storage dst;
int fin = 0;
TRACE_ENTER(HLD_STRM_EV_TASK, hs);

View file

@ -29,6 +29,13 @@
DECLARE_TYPED_POOL(pool_head_connstream, "stconn", struct stconn);
DECLARE_TYPED_POOL(pool_head_sedesc, "sedesc", struct sedesc);
/* Only used by haload */
extern __attribute__((weak))
struct task *hld_strm_task(struct task *t, void *context, unsigned int state)
{
return NULL;
}
static int sc_conn_recv(struct stconn *sc);
static int sc_conn_send(struct stconn *sc);
@ -298,6 +305,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_strm_task;
sc->wait_event.tasklet->context = __sc_hldstream(sc);;
sc->wait_event.events = 0;
}
}
sedesc->se = sd;
sedesc->conn = ctx;