MINOR: quic: Implement quic_conn_subscribe()
We implement ->subscribe() xprt callback which should be used only by the mux.
diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h
index 18e2cec..8907249 100644
--- a/include/haproxy/mux_quic-t.h
+++ b/include/haproxy/mux_quic-t.h
@@ -154,6 +154,7 @@
struct list blocked_list; /* list of streams blocked for other reasons (e.g. sfctl, dep) */
struct buffer_wait buf_wait; /* wait list for buffer allocations */
struct wait_event wait_event; /* To be used if we're waiting for I/Os */
+ struct wait_event *subs; /* recv wait_event the mux associated is waiting on (via quic_conn_subscribe) */
struct mt_list qcs_rxbuf_wlist; /* list of streams waiting for their rxbuf */
void *ctx; /* Application layer context */
const struct qcc_app_ops *app_ops;
diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h
index 1bbae96..30a28a2 100644
--- a/include/haproxy/xprt_quic-t.h
+++ b/include/haproxy/xprt_quic-t.h
@@ -215,6 +215,8 @@
#define QUIC_EV_CONN_PTIMER (1ULL << 34)
#define QUIC_EV_CONN_SPTO (1ULL << 35)
#define QUIC_EV_CONN_BCFRMS (1ULL << 36)
+#define QUIC_EV_CONN_XPRTSEND (1ULL << 37)
+#define QUIC_EV_CONN_XPRTRECV (1ULL << 38)
/* Similar to kernel min()/max() definitions. */
#define QUIC_MIN(a, b) ({ \
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index 2d79d9a..88ac8a4 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -102,6 +102,8 @@
{ .mask = QUIC_EV_CONN_PTIMER, .name = "ptimer", .desc = "process timer" },
{ .mask = QUIC_EV_CONN_SPTO, .name = "spto", .desc = "set PTO" },
{ .mask = QUIC_EV_CONN_BCFRMS, .name = "bcfrms", .desc = "build CRYPTO data frames" },
+ { .mask = QUIC_EV_CONN_XPRTSEND, .name = "xprt_send", .desc = "sending XRPT subscription" },
+ { .mask = QUIC_EV_CONN_XPRTRECV, .name = "xprt_recv", .desc = "receiving XRPT subscription" },
{ /* end */ }
};
@@ -4357,7 +4359,21 @@
*/
static int quic_conn_subscribe(struct connection *conn, void *xprt_ctx, int event_type, struct wait_event *es)
{
- return conn_subscribe(conn, xprt_ctx, event_type, es);
+ struct qcc *qcc = conn->qc->qcc;
+
+ BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
+ BUG_ON(qcc->subs && qcc->subs != es);
+
+ es->events |= event_type;
+ qcc->subs = es;
+
+ if (event_type & SUB_RETRY_RECV)
+ TRACE_DEVEL("subscribe(recv)", QUIC_EV_CONN_XPRTRECV, conn, qcc);
+
+ if (event_type & SUB_RETRY_SEND)
+ TRACE_DEVEL("subscribe(send)", QUIC_EV_CONN_XPRTSEND, conn, qcc);
+
+ return 0;
}
/* Called from the upper layer, to unsubscribe <es> from events <event_type>.