diff src/event/ngx_event_quic.c @ 8528:97da6521657c quic

QUIC: send STOP_SENDING on stream closure. The frame is sent for a read-enabled stream which has not received a FIN or RESET_STREAM.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 25 Aug 2020 14:07:26 +0300
parents 11fc65261689
children f882b1784f30
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -4564,6 +4564,27 @@ ngx_quic_stream_cleanup_handler(void *da
         return;
     }
 
+    if ((qs->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0
+        || (qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0)
+    {
+        if (!c->read->eof && !c->read->error) {
+            frame = ngx_quic_alloc_frame(pc, 0);
+            if (frame == NULL) {
+                return;
+            }
+
+            frame->level = ssl_encryption_application;
+            frame->type = NGX_QUIC_FT_STOP_SENDING;
+            frame->u.stop_sending.id = qs->id;
+            frame->u.stop_sending.error_code = 0x100; /* HTTP/3 no error */
+
+            ngx_sprintf(frame->info, "STOP_SENDING id:0x%xL err:0x%xL level:%d",
+                        qs->id, frame->u.stop_sending.error_code, frame->level);
+
+            ngx_quic_queue_frame(qc, frame);
+        }
+    }
+
     if ((qs->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0) {
         frame = ngx_quic_alloc_frame(pc, 0);
         if (frame == NULL) {