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.
(cherry picked from commit 1e340ba6bc
)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit b403127cdb6fbac47dbf16c0587166337d2531b3)
Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
parent
8ad76b6dd7
commit
110d1245b1
@ -183,12 +183,19 @@ struct qcs {
|
||||
int start; /* base timestamp for http-request timeout */
|
||||
};
|
||||
|
||||
/* Used as qcc_app_ops.close callback argument. */
|
||||
enum qcc_app_ops_close_side {
|
||||
QCC_APP_OPS_CLOSE_SIDE_RD, /* Read channel closed (RESET_STREAM received). */
|
||||
QCC_APP_OPS_CLOSE_SIDE_WR /* Write channel closed (STOP_SENDING received). */
|
||||
};
|
||||
|
||||
/* QUIC application layer operations */
|
||||
struct qcc_app_ops {
|
||||
int (*init)(struct qcc *qcc);
|
||||
int (*attach)(struct qcs *qcs, void *conn_ctx);
|
||||
ssize_t (*decode_qcs)(struct qcs *qcs, struct buffer *b, int fin);
|
||||
size_t (*snd_buf)(struct qcs *qcs, struct htx *htx, size_t count);
|
||||
int (*close)(struct qcs *qcs, enum qcc_app_ops_close_side side);
|
||||
void (*detach)(struct qcs *qcs);
|
||||
int (*finalize)(void *ctx);
|
||||
void (*shutdown)(void *ctx); /* Close a connection. */
|
||||
|
19
src/h3.c
19
src/h3.c
@ -1301,6 +1301,24 @@ static size_t h3_snd_buf(struct qcs *qcs, struct htx *htx, size_t count)
|
||||
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;
|
||||
@ -1489,6 +1507,7 @@ const struct qcc_app_ops h3_ops = {
|
||||
.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,
|
||||
|
Loading…
Reference in New Issue
Block a user