]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: extend qc_send_mux() return type with a dedicated enum
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 25 Oct 2024 14:31:26 +0000 (16:31 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 31 Oct 2024 09:32:50 +0000 (10:32 +0100)
include/haproxy/quic_tx-t.h
include/haproxy/quic_tx.h
src/mux_quic.c
src/quic_tx.c

index efbdfe68703ba1ffc7fb644dc0365357f98dee24..359869a314270e81c680513ca73ec33ead2541ba 100644 (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 */
index b77d6a20a5172ceff360a846ebf1efaf2e12a5b0..21f7eecf3a302b14ace27101c4d2adcfb7fc175a 100644 (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);
index 05cfa31635ec45afd19d217325fef0fecd3aa12a..23aa00559fe508fc75c9794264d101617d43825b 100644 (file)
@@ -2075,6 +2075,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)) {
@@ -2082,7 +2084,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;
index a4acaf344a6aaafc7a8da64b4d4c3a31736d9e61..654cc688f307ee4232105a51880a3fc4ccb3b26e 100644 (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;