From 220894a5d601fdfc393f84fd0afe44c5bf3c500b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Wed, 26 Jan 2022 18:04:50 +0100 Subject: [PATCH] MINOR: quic: Pass CID as a buffer to quic_get_cid_tid() Very minor modification so that this function might be used for a context without CID (at datagram level). --- include/haproxy/xprt_quic.h | 4 ++-- src/xprt_quic.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 4bda6a74d..b76d6f34d 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -133,9 +133,9 @@ static inline void quic_cid_dump(struct buffer *buf, } /* Simply compute a thread ID from a CID */ -static inline unsigned long quic_get_cid_tid(const struct quic_cid *cid) +static inline unsigned long quic_get_cid_tid(const unsigned char *cid) { - return cid->data[0] % global.nbthread; + return *cid % global.nbthread; } /* Free the CIDs attached to QUIC connection. This must be called under diff --git a/src/xprt_quic.c b/src/xprt_quic.c index cc3985e91..24c215350 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -4160,7 +4160,7 @@ int qc_conn_alloc_ssl_ctx(struct quic_conn *qc) /* Set tasklet tid based on the SCID selected by us for this * connection. The upper layer will also be binded on the same thread. */ - qc->tid = ctx->wait_event.tasklet->tid = quic_get_cid_tid(&qc->scid); + qc->tid = ctx->wait_event.tasklet->tid = quic_get_cid_tid(qc->scid.data); if (qc_is_listener(qc)) { if (qc_ssl_sess_init(qc, bc->initial_ctx, &ctx->ssl,