comparison src/event/ngx_event_quic.c @ 8322:d9bc33166361 quic

Do not set timers after the connection is closed. The qc->closing flag is set when a connection close is initiated for the first time. No timers will be set if the flag is active. TODO: this is a temporary solution to avoid running timer handlers after connection (and it's pool) was destroyed. It looks like currently we have no clear policy of connection closing in regard to timers.
author Vladimir Homutov <vl@nginx.com>
date Sat, 04 Apr 2020 22:27:29 +0300
parents e45719a9b148
children 9b9d592c0da3
comparison
equal deleted inserted replaced
8321:e45719a9b148 8322:d9bc33166361
702 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "close quic connection"); 702 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "close quic connection");
703 703
704 qc = c->quic; 704 qc = c->quic;
705 705
706 if (qc) { 706 if (qc) {
707 qc->closing = 1;
707 tree = &qc->streams.tree; 708 tree = &qc->streams.tree;
708 709
709 if (tree->root != tree->sentinel) { 710 if (tree->root != tree->sentinel) {
710 if (c->read->timer_set) { 711 if (c->read->timer_set) {
711 ngx_del_timer(c->read); 712 ngx_del_timer(c->read);
725 rev->ready = 1; 726 rev->ready = 1;
726 rev->pending_eof = 1; 727 rev->pending_eof = 1;
727 728
728 ngx_post_event(rev, &ngx_posted_events); 729 ngx_post_event(rev, &ngx_posted_events);
729 730
731 if (rev->timer_set) {
732 ngx_del_timer(rev);
733 }
734
730 #if (NGX_DEBUG) 735 #if (NGX_DEBUG)
731 ns++; 736 ns++;
732 #endif 737 #endif
733 } 738 }
734 739
735 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 740 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
736 "quic connection has %ui active streams", ns); 741 "quic connection has %ui active streams", ns);
737 742
738 qc->closing = 1;
739 return; 743 return;
740 } 744 }
741 745
742 if (qc->push.timer_set) { 746 if (qc->push.timer_set) {
743 ngx_del_timer(&qc->push); 747 ngx_del_timer(&qc->push);
1620 if (ngx_quic_output_ns(c, ns, i) != NGX_OK) { 1624 if (ngx_quic_output_ns(c, ns, i) != NGX_OK) {
1621 return NGX_ERROR; 1625 return NGX_ERROR;
1622 } 1626 }
1623 } 1627 }
1624 1628
1625 if (!qc->send_timer_set) { 1629 if (!qc->send_timer_set && !qc->closing) {
1626 qc->send_timer_set = 1; 1630 qc->send_timer_set = 1;
1627 ngx_add_timer(c->read, qc->tp.max_idle_timeout); 1631 ngx_add_timer(c->read, qc->tp.max_idle_timeout);
1628 } 1632 }
1629 1633
1630 if (!qc->retry.timer_set && !qc->closing) { 1634 if (!qc->retry.timer_set && !qc->closing) {