MINOR: mux-quic/h3: define stream close callback
Define a new qcc_app_ops callback named close(). This will be used to
notify app-layer about the closure of a stream by the remote peer. Its
main usage is to ensure that the closure is allowed by the application
protocol specification.
For the moment, close is not implemented by H3 layer. However, this
function will be mandatory to properly reject a STOP_SENDING on the
control stream and preventing a later crash. As such, this commit must
be backported with the next one on 2.6.
This is related to github issue #2006.
diff --git a/src/h3.c b/src/h3.c
index 14637e5..e802d29 100644
--- a/src/h3.c
+++ b/src/h3.c
@@ -1601,6 +1601,24 @@
return total;
}
+/* Notify about a closure on <qcs> stream requested by the remote peer.
+ *
+ * Stream channel <side> is explained relative to our endpoint : WR for
+ * STOP_SENDING or RD for RESET_STREAM reception. Callback decode_qcs() is used
+ * instead for closure performed using a STREAM frame with FIN bit.
+ *
+ * The main objective of this function is to check if closure is valid
+ * according to HTTP/3 specification.
+ *
+ * Returns 0 on success else non-zero. A CONNECTION_CLOSE is generated on
+ * error.
+ */
+static int h3_close(struct qcs *qcs, enum qcc_app_ops_close_side side)
+{
+ /* TODO */
+ return 0;
+}
+
static int h3_attach(struct qcs *qcs, void *conn_ctx)
{
struct h3s *h3s;
@@ -1795,6 +1813,7 @@
.attach = h3_attach,
.decode_qcs = h3_decode_qcs,
.snd_buf = h3_snd_buf,
+ .close = h3_close,
.detach = h3_detach,
.finalize = h3_finalize,
.shutdown = h3_shutdown,