diff --git a/include/haproxy/quic_tx.h b/include/haproxy/quic_tx.h index 7dc83dbfd..fe12874a0 100644 --- a/include/haproxy/quic_tx.h +++ b/include/haproxy/quic_tx.h @@ -35,9 +35,9 @@ struct buffer *qc_get_txb(struct quic_conn *qc); void qel_register_send(struct list *send_list, struct quic_enc_level *qel, struct list *frms); -int qc_prep_hpkts(struct quic_conn *qc, struct buffer *buf, struct list *qels); -int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx); +int qc_send_hdshk_pkts(struct quic_conn *qc, int old_data, struct list *send_list); int qc_send_app_pkts(struct quic_conn *qc, struct list *frms); + int qc_dgrams_retransmit(struct quic_conn *qc); void qc_prep_hdshk_fast_retrans(struct quic_conn *qc, struct list *ifrms, struct list *hfrms); diff --git a/src/quic_conn.c b/src/quic_conn.c index f3ff16338..f3e3111a3 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -741,11 +741,9 @@ static struct quic_conn_closed *qc_new_cc_conn(struct quic_conn *qc) /* QUIC connection packet handler task. */ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state) { - int ret; struct quic_conn *qc = context; - struct buffer *buf = NULL; struct list send_list = LIST_HEAD_INIT(send_list); - struct quic_enc_level *qel, *tmp_qel; + struct quic_enc_level *qel; int st; struct tasklet *tl = (struct tasklet *)t; @@ -798,41 +796,11 @@ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state) list_for_each_entry(qel, &qc->qel_list, list) qel_register_send(&send_list, qel, &qel->pktns->tx.frms); - buf = qc_get_txb(qc); - if (!buf) - goto out; - - if (b_data(buf) && !qc_purge_txbuf(qc, buf)) - goto out; - - /* Currently buf cannot be non-empty at this stage. Even if a previous - * sendto() has failed it is emptied to simulate packet emission and - * rely on QUIC lost detection to try to emit it. - */ - BUG_ON_HOT(b_data(buf)); - b_reset(buf); - - ret = qc_prep_hpkts(qc, buf, &send_list); - - /* Always reset QEL sending list. */ - list_for_each_entry_safe(qel, tmp_qel, &send_list, el_send) { - LIST_DEL_INIT(&qel->el_send); - qel->send_frms = NULL; - } - - if (ret == -1) { - qc_txb_release(qc); + if (!qc_send_hdshk_pkts(qc, 0, &send_list)) { + TRACE_DEVEL("qc_send_hdshk_pkts() failed", QUIC_EV_CONN_IO_CB, qc); goto out; } - if (ret && !qc_send_ppkts(buf, qc->xprt_ctx)) { - if (qc->flags & QUIC_FL_CONN_TO_KILL) - qc_txb_release(qc); - goto out; - } - - qc_txb_release(qc); - out: /* Release the Handshake encryption level and packet number space if * the Handshake is confirmed and if there is no need to send diff --git a/src/quic_tx.c b/src/quic_tx.c index ee587aca0..eca3799fd 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -362,7 +362,7 @@ static void qc_purge_tx_buf(struct quic_conn *qc, struct buffer *buf) * Remaining data are purged from the buffer and will eventually be detected * as lost which gives the opportunity to retry sending. */ -int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx) +static int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx) { int ret = 0; struct quic_conn *qc; @@ -659,7 +659,8 @@ static inline void qc_select_tls_ver(struct quic_conn *qc, * Returns the number of bytes prepared in datragrams/packets if succeeded * (may be 0), or -1 if something wrong happened. */ -int qc_prep_hpkts(struct quic_conn *qc, struct buffer *buf, struct list *qels) +static int qc_prep_hpkts(struct quic_conn *qc, struct buffer *buf, + struct list *qels) { int ret, cc, padding; struct quic_tx_packet *first_pkt, *prv_pkt;