MINOR: quic: Attach timer task to thread for the connection.

This is to avoid races between the connection I/O handler and this task
which share too much variables.
This commit is contained in:
Frédéric Lécaille 2021-12-09 10:06:21 +01:00 committed by Amaury Denoyelle
parent 2d2ceb5e6e
commit f57c333ac1
2 changed files with 5 additions and 3 deletions

View File

@ -627,7 +627,8 @@ struct quic_conn {
uint32_t version;
/* QUIC transport parameters TLS extension */
int tps_tls_ext;
/* Thread ID this connection is attached to */
int tid;
int state;
uint64_t err_code;
unsigned char enc_params[QUIC_TP_MAX_ENCLEN]; /* encoded QUIC transport parameters */

View File

@ -3424,7 +3424,8 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4,
*/
static int quic_conn_init_timer(struct quic_conn *qc)
{
qc->timer_task = task_new_anywhere();
/* Attach this task to the same thread ID used for the connection */
qc->timer_task = task_new(1UL << qc->tid);
if (!qc->timer_task)
return 0;
@ -5066,7 +5067,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);
qc->tid = ctx->wait_event.tasklet->tid = quic_get_cid_tid(&qc->scid);
if (qc_ssl_sess_init(qc, bc->initial_ctx, &ctx->ssl,
qc->enc_params, qc->enc_params_len) == -1)
goto err;