summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic.c
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2022-02-01 13:05:38 +0300
committerVladimir Homutov <vl@nginx.com>2022-02-01 13:05:38 +0300
commit271553bbf37b99991c3c86164a5e83ce2b57870d (patch)
treeb7d093cbc3c4b2459f48c3cf470ee90cd4ebe7f5 /src/event/quic/ngx_event_quic.c
parent3f94e45a3b27a80d60be75bbcd7ef5b2c5e11a91 (diff)
downloadnginx-271553bbf37b99991c3c86164a5e83ce2b57870d.tar.gz
nginx-271553bbf37b99991c3c86164a5e83ce2b57870d.tar.bz2
QUIC: merged ngx_quic_close_quic() and ngx_quic_close_connection().
The separate ngx_quic_close_quic() doesn't make much sense.
Diffstat (limited to 'src/event/quic/ngx_event_quic.c')
-rw-r--r--src/event/quic/ngx_event_quic.c63
1 files changed, 26 insertions, 37 deletions
diff --git a/src/event/quic/ngx_event_quic.c b/src/event/quic/ngx_event_quic.c
index ed970bc4c..20ff3305c 100644
--- a/src/event/quic/ngx_event_quic.c
+++ b/src/event/quic/ngx_event_quic.c
@@ -16,7 +16,6 @@ static ngx_int_t ngx_quic_handle_stateless_reset(ngx_connection_t *c,
ngx_quic_header_t *pkt);
static void ngx_quic_input_handler(ngx_event_t *rev);
-static ngx_int_t ngx_quic_close_quic(ngx_connection_t *c, ngx_int_t rc);
static void ngx_quic_close_timer_handler(ngx_event_t *ev);
static ngx_int_t ngx_quic_handle_datagram(ngx_connection_t *c, ngx_buf_t *b,
@@ -455,7 +454,9 @@ ngx_quic_input_handler(ngx_event_t *rev)
void
ngx_quic_close_connection(ngx_connection_t *c, ngx_int_t rc)
{
+ ngx_uint_t i;
ngx_pool_t *pool;
+ ngx_quic_send_ctx_t *ctx;
ngx_quic_connection_t *qc;
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
@@ -469,41 +470,9 @@ ngx_quic_close_connection(ngx_connection_t *c, ngx_int_t rc)
"quic close connection early error");
}
- } else if (ngx_quic_close_quic(c, rc) == NGX_AGAIN) {
- return;
- }
-
- if (c->ssl) {
- (void) ngx_ssl_shutdown(c);
- }
-
- if (c->read->timer_set) {
- ngx_del_timer(c->read);
+ goto quic_done;
}
-#if (NGX_STAT_STUB)
- (void) ngx_atomic_fetch_add(ngx_stat_active, -1);
-#endif
-
- c->destroyed = 1;
-
- pool = c->pool;
-
- ngx_close_connection(c);
-
- ngx_destroy_pool(pool);
-}
-
-
-static ngx_int_t
-ngx_quic_close_quic(ngx_connection_t *c, ngx_int_t rc)
-{
- ngx_uint_t i;
- ngx_quic_send_ctx_t *ctx;
- ngx_quic_connection_t *qc;
-
- qc = ngx_quic_get_connection(c);
-
if (!qc->closing) {
/* drop packets from retransmit queues, no ack is expected */
@@ -582,7 +551,7 @@ ngx_quic_close_quic(ngx_connection_t *c, ngx_int_t rc)
}
if (ngx_quic_close_streams(c, qc) == NGX_AGAIN) {
- return NGX_AGAIN;
+ return;
}
if (qc->push.timer_set) {
@@ -602,7 +571,7 @@ ngx_quic_close_quic(ngx_connection_t *c, ngx_int_t rc)
}
if (qc->close.timer_set) {
- return NGX_AGAIN;
+ return;
}
ngx_quic_close_sockets(c);
@@ -613,7 +582,27 @@ ngx_quic_close_quic(ngx_connection_t *c, ngx_int_t rc)
/* may be tested from SSL callback during SSL shutdown */
c->udp = NULL;
- return NGX_OK;
+quic_done:
+
+ if (c->ssl) {
+ (void) ngx_ssl_shutdown(c);
+ }
+
+ if (c->read->timer_set) {
+ ngx_del_timer(c->read);
+ }
+
+#if (NGX_STAT_STUB)
+ (void) ngx_atomic_fetch_add(ngx_stat_active, -1);
+#endif
+
+ c->destroyed = 1;
+
+ pool = c->pool;
+
+ ngx_close_connection(c);
+
+ ngx_destroy_pool(pool);
}