# HG changeset patch # User Vladimir Homutov # Date 1600685897 -10800 # Node ID dbcb9d0a3df19e71d5fc57fceb508eafbf3f371a # Parent 351d62300832fcadebbf7d6463f1631590bf0a29 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. diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c --- 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");