changeset 8553:dbcb9d0a3df1 quic

QUIC: prevented posted push event while in the draining state. If the push event was posted before ngx_quic_close_connection(), it could send data in the draining state.
author Vladimir Homutov <vl@nginx.com>
date Mon, 21 Sep 2020 13:58:17 +0300
parents 351d62300832
children 2885cd81adb3
files src/event/ngx_event_quic.c
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -1492,19 +1492,6 @@ ngx_quic_close_quic(ngx_connection_t *c,
         return NGX_AGAIN;
     }
 
-    if (qc->close.timer_set) {
-        return NGX_AGAIN;
-    }
-
-    for (i = 0; i < NGX_QUIC_ENCRYPTION_LAST; i++) {
-        ngx_quic_free_frames(c, &qc->crypto[i].frames);
-    }
-
-    for (i = 0; i < NGX_QUIC_SEND_CTX_LAST; i++) {
-        ngx_quic_free_frames(c, &qc->send_ctx[i].frames);
-        ngx_quic_free_frames(c, &qc->send_ctx[i].sent);
-    }
-
     if (qc->push.timer_set) {
         ngx_del_timer(&qc->push);
     }
@@ -1517,6 +1504,19 @@ ngx_quic_close_quic(ngx_connection_t *c,
         ngx_delete_posted_event(&qc->push);
     }
 
+    for (i = 0; i < NGX_QUIC_ENCRYPTION_LAST; i++) {
+        ngx_quic_free_frames(c, &qc->crypto[i].frames);
+    }
+
+    for (i = 0; i < NGX_QUIC_SEND_CTX_LAST; i++) {
+        ngx_quic_free_frames(c, &qc->send_ctx[i].frames);
+        ngx_quic_free_frames(c, &qc->send_ctx[i].sent);
+    }
+
+    if (qc->close.timer_set) {
+        return NGX_AGAIN;
+    }
+
     ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
                    "quic part of connection is terminated");