summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic_streams.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2021-09-21 16:24:33 +0300
committerRoman Arutyunyan <arut@nginx.com>2021-09-21 16:24:33 +0300
commit010f974e44082625056f4282ab66696f3708d4cf (patch)
treea32d30fa0f83010c42c2c970b41e28b384ea3e68 /src/event/quic/ngx_event_quic_streams.c
parent22f2dc2a875318870887315d9697b47911172977 (diff)
downloadnginx-010f974e44082625056f4282ab66696f3708d4cf.tar.gz
nginx-010f974e44082625056f4282ab66696f3708d4cf.tar.bz2
QUIC: send RESET_STREAM in response to STOP_SENDING.
As per RFC 9000: An endpoint that receives a STOP_SENDING frame MUST send a RESET_STREAM frame if the stream is in the "Ready" or "Send" state. An endpoint SHOULD copy the error code from the STOP_SENDING frame to the RESET_STREAM frame it sends, but it can use any application error code.
Diffstat (limited to 'src/event/quic/ngx_event_quic_streams.c')
-rw-r--r--src/event/quic/ngx_event_quic_streams.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c
index 0bd487f83..a49117dc9 100644
--- a/src/event/quic/ngx_event_quic_streams.c
+++ b/src/event/quic/ngx_event_quic_streams.c
@@ -1253,6 +1253,7 @@ ngx_int_t
ngx_quic_handle_stop_sending_frame(ngx_connection_t *c,
ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f)
{
+ ngx_pool_t *pool;
ngx_event_t *wev;
ngx_connection_t *sc;
ngx_quic_stream_t *qs;
@@ -1282,16 +1283,23 @@ ngx_quic_handle_stop_sending_frame(ngx_connection_t *c,
sc = qs->connection;
- wev = sc->write;
- wev->error = 1;
- wev->ready = 1;
+ if (ngx_quic_reset_stream(sc, f->error_code) != NGX_OK) {
+ pool = sc->pool;
+
+ ngx_close_connection(sc);
+ ngx_destroy_pool(pool);
+
+ return NGX_ERROR;
+ }
return ngx_quic_init_stream(qs);
}
+ if (ngx_quic_reset_stream(qs->connection, f->error_code) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
wev = qs->connection->write;
- wev->error = 1;
- wev->ready = 1;
if (wev->active) {
wev->handler(wev);