]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: adapt return value of qcc_decode_qcs()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 3 Mar 2025 09:01:07 +0000 (10:01 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 7 Mar 2025 11:06:26 +0000 (12:06 +0100)
Change return value of qcc_decode_qcs(). It now directly returns the
value from app_ops rcv_buf callback. Function documentation is updated
to reflect this.

For now, qcc_decode_qcs() return value is ignored by callers, so this
patch should not have any functional change. However, it will become
necessary when implementing multiple Rx buffers per QCS, as a loop will
be implemented to invoke qcc_decode_qcs() on several contiguous buffers.
Decoding must be stopped however as soon as an error is returned by
rcv_buf callback. This is also the case in case of a null value, which
indicates there is not enough data to continue decoding.

src/mux_quic.c

index 44b4b538f84420ebc5a3f90a0563306323a8bed1..939136cf8438a404be28c76ec4a330194875bbac 100644 (file)
@@ -1181,9 +1181,12 @@ static void qcs_consume(struct qcs *qcs, uint64_t bytes, struct qc_stream_rxbuf
 }
 
 /* Decode the content of STREAM frames already received on the stream instance
- * <qcs>.
+ * <qcs> from the <qcc> connection.
  *
- * Returns 0 on success else non-zero.
+ * Returns the result of app_ops rcv_buf callback, which is the number of bytes
+ * successfully transcoded, or a negative error code. If no error occurred but
+ * decoding cannot proceed due to missing data, the return value is 0. The
+ * value 0 may also be returned when dealing with a standalone FIN signal.
  */
 static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
 {
@@ -1237,11 +1240,11 @@ static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
                qcs_notify_recv(qcs);
 
        TRACE_LEAVE(QMUX_EV_QCS_RECV, qcc->conn, qcs);
-       return 0;
+       return ret;
 
  err:
-       TRACE_LEAVE(QMUX_EV_QCS_RECV, qcc->conn, qcs);
-       return 1;
+       TRACE_DEVEL("leaving on error", QMUX_EV_QCS_RECV, qcc->conn, qcs);
+       return ret;
 }
 
 /* Allocate if needed and retrieve <qcs> stream buffer for data reception.