]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: add trace to stream rcv_buf operation
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 15 May 2023 09:35:45 +0000 (11:35 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 16 May 2023 15:53:45 +0000 (17:53 +0200)
Add traces to render each stream transition more explicit. Also, move
ERR_PENDING to ERROR transition after other stream flags are set, as
with the MUX H2 implementation. This is purely a cosmetic change and it
should have no functional impact.

This should be backported up to 2.7.

src/mux_quic.c

index 5fd8c74781fd051a56ebc249c1de049a84429a85..7db03210ae91785247aa4b97020f62f1ce537eea 100644 (file)
@@ -2644,10 +2644,11 @@ static size_t qc_recv_buf(struct stconn *sc, struct buffer *buf,
                           size_t count, int flags)
 {
        struct qcs *qcs = __sc_mux_strm(sc);
+       struct qcc *qcc = qcs->qcc;
        size_t ret = 0;
        char fin = 0;
 
-       TRACE_ENTER(QMUX_EV_STRM_RECV, qcs->qcc->conn, qcs);
+       TRACE_ENTER(QMUX_EV_STRM_RECV, qcc->conn, qcs);
 
        ret = qcs_http_rcv_buf(qcs, buf, count, &fin);
 
@@ -2656,11 +2657,10 @@ static size_t qc_recv_buf(struct stconn *sc, struct buffer *buf,
        }
        else {
                se_fl_clr(qcs->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
-               if (se_fl_test(qcs->sd, SE_FL_ERR_PENDING))
-                       se_fl_set(qcs->sd, SE_FL_ERROR);
 
                /* Set end-of-input if FIN received and all data extracted. */
                if (fin) {
+                       TRACE_STATE("report end-of-input", QMUX_EV_STRM_RECV, qcc->conn, qcs);
                        se_fl_set(qcs->sd, SE_FL_EOI);
 
                        /* If request EOM is reported to the upper layer, it means the
@@ -2669,6 +2669,11 @@ static size_t qc_recv_buf(struct stconn *sc, struct buffer *buf,
                        se_expect_data(qcs->sd);
                }
 
+               if (se_fl_test(qcs->sd, SE_FL_ERR_PENDING)) {
+                       TRACE_STATE("report error", QMUX_EV_STRM_RECV, qcc->conn, qcs);
+                       se_fl_set(qcs->sd, SE_FL_ERROR);
+               }
+
                if (b_size(&qcs->rx.app_buf)) {
                        b_free(&qcs->rx.app_buf);
                        offer_buffers(NULL, 1);
@@ -2684,11 +2689,11 @@ static size_t qc_recv_buf(struct stconn *sc, struct buffer *buf,
                BUG_ON(!ncb_data(&qcs->rx.ncbuf, 0));
 
                qcs->flags &= ~QC_SF_DEM_FULL;
-               if (!(qcs->qcc->flags & QC_CF_ERRL))
-                       tasklet_wakeup(qcs->qcc->wait_event.tasklet);
+               if (!(qcc->flags & QC_CF_ERRL))
+                       tasklet_wakeup(qcc->wait_event.tasklet);
        }
 
-       TRACE_LEAVE(QMUX_EV_STRM_RECV, qcs->qcc->conn, qcs);
+       TRACE_LEAVE(QMUX_EV_STRM_RECV, qcc->conn, qcs);
 
        return ret;
 }