MINOR: quic: extend qc_send_mux() return type with a dedicated enum

This commit is part of a adjustment on QUIC transport send API to
support pacing. Here, qc_send_mux() return type has been changed to use
a new enum quic_tx_err.

This is useful to explain different failure causes of emission. For now,
only two values have been defined : NONE and FATAL. When pacing will be
implemented, a new value would be added to specify that emission was
interrupted on pacing. This won't be a fatal error as this allows to
retry emission but not immediately.
This commit is contained in:
Amaury Denoyelle 2024-10-25 16:31:26 +02:00
parent 5cb8f8a622
commit 7fd48a5723
4 changed files with 17 additions and 6 deletions

View File

@ -64,4 +64,9 @@ enum qc_build_pkt_err {
QC_BUILD_PKT_ERR_BUFROOM, /* no more room in input buf or congestion window */
};
enum quic_tx_err {
QUIC_TX_ERR_NONE,
QUIC_TX_ERR_FATAL,
};
#endif /* _HAPROXY_TX_T_H */

View File

@ -33,7 +33,7 @@ void qc_txb_release(struct quic_conn *qc);
int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf);
struct buffer *qc_get_txb(struct quic_conn *qc);
int qc_send_mux(struct quic_conn *qc, struct list *frms);
enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms);
void qel_register_send(struct list *send_list, struct quic_enc_level *qel,
struct list *frms);

View File

@ -2074,6 +2074,8 @@ static int qcc_subscribe_send(struct qcc *qcc)
*/
static int qcc_send_frames(struct qcc *qcc, struct list *frms)
{
enum quic_tx_err ret;
TRACE_ENTER(QMUX_EV_QCC_SEND, qcc->conn);
if (LIST_ISEMPTY(frms)) {
@ -2081,7 +2083,8 @@ static int qcc_send_frames(struct qcc *qcc, struct list *frms)
return 1;
}
if (!qc_send_mux(qcc->conn->handle.qc, frms)) {
ret = qc_send_mux(qcc->conn->handle.qc, frms);
if (ret == QUIC_TX_ERR_FATAL) {
TRACE_DEVEL("error on sending", QMUX_EV_QCC_SEND, qcc->conn);
qcc_subscribe_send(qcc);
goto err;

View File

@ -469,10 +469,11 @@ int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf)
*
* Returns the result from qc_send() function.
*/
int qc_send_mux(struct quic_conn *qc, struct list *frms)
enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms)
{
struct list send_list = LIST_HEAD_INIT(send_list);
int ret;
enum quic_tx_err ret = QUIC_TX_ERR_NONE;
int sent;
TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc);
BUG_ON(qc->mux_state != QC_MUX_READY); /* Only MUX can uses this function so it must be ready. */
@ -480,7 +481,7 @@ int qc_send_mux(struct quic_conn *qc, struct list *frms)
if (qc->conn->flags & CO_FL_SOCK_WR_SH) {
qc->conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
TRACE_DEVEL("connection on error", QUIC_EV_CONN_TXPKT, qc);
return 0;
return QUIC_TX_ERR_FATAL;
}
/* Try to send post handshake frames first unless on 0-RTT. */
@ -493,7 +494,9 @@ int qc_send_mux(struct quic_conn *qc, struct list *frms)
TRACE_STATE("preparing data (from MUX)", QUIC_EV_CONN_TXPKT, qc);
qel_register_send(&send_list, qc->ael, frms);
ret = qc_send(qc, 0, &send_list, 0);
sent = qc_send(qc, 0, &send_list, 0);
if (sent <= 0)
ret = QUIC_TX_ERR_FATAL;
TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);
return ret;