mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
MINOR: quic: use qc_send_hdshk_pkts() in handshake IO cb
quic_conn_io_cb() manually implements emission by using lower level functions qc_prep_pkts() and qc_send_ppkts(). Replace this by using the higher level function qc_send_hdshk_pkts() which notably handle buffer allocation and purging. This allows to clean up send API by flagging qc_prep_pkts() and qc_send_ppkts() as static. They are now used in a single location inside qc_send_hdshk_pkts().
This commit is contained in:
parent
3a8f4761e7
commit
4e4127a66d
@ -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,
|
void qel_register_send(struct list *send_list, struct quic_enc_level *qel,
|
||||||
struct list *frms);
|
struct list *frms);
|
||||||
int qc_prep_hpkts(struct quic_conn *qc, struct buffer *buf, struct list *qels);
|
int qc_send_hdshk_pkts(struct quic_conn *qc, int old_data, struct list *send_list);
|
||||||
int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx);
|
|
||||||
int qc_send_app_pkts(struct quic_conn *qc, struct list *frms);
|
int qc_send_app_pkts(struct quic_conn *qc, struct list *frms);
|
||||||
|
|
||||||
int qc_dgrams_retransmit(struct quic_conn *qc);
|
int qc_dgrams_retransmit(struct quic_conn *qc);
|
||||||
void qc_prep_hdshk_fast_retrans(struct quic_conn *qc,
|
void qc_prep_hdshk_fast_retrans(struct quic_conn *qc,
|
||||||
struct list *ifrms, struct list *hfrms);
|
struct list *ifrms, struct list *hfrms);
|
||||||
|
|||||||
@ -741,11 +741,9 @@ static struct quic_conn_closed *qc_new_cc_conn(struct quic_conn *qc)
|
|||||||
/* QUIC connection packet handler task. */
|
/* QUIC connection packet handler task. */
|
||||||
struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
|
struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
struct quic_conn *qc = context;
|
struct quic_conn *qc = context;
|
||||||
struct buffer *buf = NULL;
|
|
||||||
struct list send_list = LIST_HEAD_INIT(send_list);
|
struct list send_list = LIST_HEAD_INIT(send_list);
|
||||||
struct quic_enc_level *qel, *tmp_qel;
|
struct quic_enc_level *qel;
|
||||||
int st;
|
int st;
|
||||||
struct tasklet *tl = (struct tasklet *)t;
|
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)
|
list_for_each_entry(qel, &qc->qel_list, list)
|
||||||
qel_register_send(&send_list, qel, &qel->pktns->tx.frms);
|
qel_register_send(&send_list, qel, &qel->pktns->tx.frms);
|
||||||
|
|
||||||
buf = qc_get_txb(qc);
|
if (!qc_send_hdshk_pkts(qc, 0, &send_list)) {
|
||||||
if (!buf)
|
TRACE_DEVEL("qc_send_hdshk_pkts() failed", QUIC_EV_CONN_IO_CB, qc);
|
||||||
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);
|
|
||||||
goto out;
|
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:
|
out:
|
||||||
/* Release the Handshake encryption level and packet number space if
|
/* Release the Handshake encryption level and packet number space if
|
||||||
* the Handshake is confirmed and if there is no need to send
|
* the Handshake is confirmed and if there is no need to send
|
||||||
|
|||||||
@ -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
|
* Remaining data are purged from the buffer and will eventually be detected
|
||||||
* as lost which gives the opportunity to retry sending.
|
* 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;
|
int ret = 0;
|
||||||
struct quic_conn *qc;
|
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
|
* Returns the number of bytes prepared in datragrams/packets if succeeded
|
||||||
* (may be 0), or -1 if something wrong happened.
|
* (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;
|
int ret, cc, padding;
|
||||||
struct quic_tx_packet *first_pkt, *prv_pkt;
|
struct quic_tx_packet *first_pkt, *prv_pkt;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user