Skip to content

Commit 35843c9

Browse files
a-denoyellehaproxyFred
authored andcommitted
MINOR: quic: extend qc_send_mux() return type with a dedicated enum
1 parent fb91410 commit 35843c9

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

include/haproxy/quic_tx-t.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ enum qc_build_pkt_err {
6464
QC_BUILD_PKT_ERR_BUFROOM, /* no more room in input buf or congestion window */
6565
};
6666

67+
enum quic_tx_err {
68+
QUIC_TX_ERR_NONE,
69+
QUIC_TX_ERR_FATAL,
70+
};
71+
6772
#endif /* _HAPROXY_TX_T_H */

include/haproxy/quic_tx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void qc_txb_release(struct quic_conn *qc);
3333
int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf);
3434
struct buffer *qc_get_txb(struct quic_conn *qc);
3535

36-
int qc_send_mux(struct quic_conn *qc, struct list *frms);
36+
enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms);
3737

3838
void qel_register_send(struct list *send_list, struct quic_enc_level *qel,
3939
struct list *frms);

src/mux_quic.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2075,14 +2075,17 @@ static int qcc_subscribe_send(struct qcc *qcc)
20752075
*/
20762076
static int qcc_send_frames(struct qcc *qcc, struct list *frms)
20772077
{
2078+
enum quic_tx_err ret;
2079+
20782080
TRACE_ENTER(QMUX_EV_QCC_SEND, qcc->conn);
20792081

20802082
if (LIST_ISEMPTY(frms)) {
20812083
TRACE_DEVEL("leaving on no frame to send", QMUX_EV_QCC_SEND, qcc->conn);
20822084
return 1;
20832085
}
20842086

2085-
if (!qc_send_mux(qcc->conn->handle.qc, frms)) {
2087+
ret = qc_send_mux(qcc->conn->handle.qc, frms);
2088+
if (ret == QUIC_TX_ERR_FATAL) {
20862089
TRACE_DEVEL("error on sending", QMUX_EV_QCC_SEND, qcc->conn);
20872090
qcc_subscribe_send(qcc);
20882091
goto err;

src/quic_tx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,18 +469,19 @@ int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf)
469469
*
470470
* Returns the result from qc_send() function.
471471
*/
472-
int qc_send_mux(struct quic_conn *qc, struct list *frms)
472+
enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms)
473473
{
474474
struct list send_list = LIST_HEAD_INIT(send_list);
475-
int ret;
475+
enum quic_tx_err ret = QUIC_TX_ERR_NONE;
476+
int sent;
476477

477478
TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc);
478479
BUG_ON(qc->mux_state != QC_MUX_READY); /* Only MUX can uses this function so it must be ready. */
479480

480481
if (qc->conn->flags & CO_FL_SOCK_WR_SH) {
481482
qc->conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
482483
TRACE_DEVEL("connection on error", QUIC_EV_CONN_TXPKT, qc);
483-
return 0;
484+
return QUIC_TX_ERR_FATAL;
484485
}
485486

486487
/* 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)
493494

494495
TRACE_STATE("preparing data (from MUX)", QUIC_EV_CONN_TXPKT, qc);
495496
qel_register_send(&send_list, qc->ael, frms);
496-
ret = qc_send(qc, 0, &send_list, 0);
497+
sent = qc_send(qc, 0, &send_list, 0);
498+
if (sent <= 0)
499+
ret = QUIC_TX_ERR_FATAL;
497500

498501
TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);
499502
return ret;

0 commit comments

Comments
 (0)