]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Attach the QUIC connection to a thread.
authorFrédéric Lécaille <flecaille@haproxy.com>
Fri, 3 Sep 2021 13:56:18 +0000 (15:56 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
Compute a thread ID from a QUIC CID and attach the I/O handler to this
thread.

include/haproxy/xprt_quic.h
src/xprt_quic.c

index 0586124d08e0c4b64a29197194e2b3f7f83237e2..1158d0de55c0e684f130fa65910511a05fb8f1aa 100644 (file)
@@ -117,6 +117,12 @@ static inline void quic_cid_dump(struct buffer *buf, struct quic_cid *cid)
        chunk_appendf(buf, ")");
 }
 
+/* Simply compute a thread ID from a CID */
+static inline unsigned long quic_get_cid_tid(const struct quic_cid *cid)
+{
+       return cid->data[0] % global.nbthread;
+}
+
 /* Free the CIDs attached to <conn> QUIC connection.
  * Always succeeds.
  */
index ee7004bf4e91803beac5b9c38604b2113a42eaad..cfe43b1a538fe2561014b27539dc938afe7743a6 100644 (file)
@@ -4406,6 +4406,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
                struct bind_conf *bc = __objt_listener(conn->target)->bind_conf;
                struct quic_conn *qc = ctx->conn->qc;
 
+               ctx->wait_event.tasklet->tid = quic_get_cid_tid(&qc->scid);
                if (ssl_bio_and_sess_init(conn, bc->initial_ctx,
                                          &ctx->ssl, &ctx->bio, ha_quic_meth, ctx) == -1)
                        goto err;