aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_connection.c18
-rw-r--r--src/core/ngx_connection.h12
-rw-r--r--src/core/ngx_core.h39
3 files changed, 43 insertions, 26 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index c082d0dac..21f9980f2 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -1034,6 +1034,12 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
+#if (NGX_QUIC)
+ if (ls[i].quic) {
+ continue;
+ }
+#endif
+
c = ls[i].connection;
if (c) {
@@ -1176,11 +1182,6 @@ ngx_close_connection(ngx_connection_t *c)
ngx_uint_t log_error, level;
ngx_socket_t fd;
- if (c->fd == (ngx_socket_t) -1) {
- ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
- return;
- }
-
if (c->read->timer_set) {
ngx_del_timer(c->read);
}
@@ -1189,7 +1190,7 @@ ngx_close_connection(ngx_connection_t *c)
ngx_del_timer(c->write);
}
- if (!c->shared) {
+ if (!c->shared && c->fd != (ngx_socket_t) -1) {
if (ngx_del_conn) {
ngx_del_conn(c, NGX_CLOSE_EVENT);
@@ -1221,6 +1222,11 @@ ngx_close_connection(ngx_connection_t *c)
ngx_free_connection(c);
+ if (c->fd == (ngx_socket_t) -1) {
+ ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, "connection has no fd");
+ return;
+ }
+
fd = c->fd;
c->fd = (ngx_socket_t) -1;
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index ad6556d0c..2ce0f153b 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -75,6 +75,7 @@ struct ngx_listening_s {
unsigned reuseport:1;
unsigned add_reuseport:1;
unsigned keepalive:2;
+ unsigned quic:1;
unsigned deferred_accept:1;
unsigned delete_deferred:1;
@@ -147,13 +148,18 @@ struct ngx_connection_s {
socklen_t socklen;
ngx_str_t addr_text;
- ngx_proxy_protocol_t *proxy_protocol;
+ ngx_proxy_protocol_t *proxy_protocol;
+
+#if (NGX_QUIC || NGX_COMPAT)
+ ngx_quic_connection_t *quic;
+ ngx_quic_stream_t *qs;
+#endif
#if (NGX_SSL || NGX_COMPAT)
- ngx_ssl_connection_t *ssl;
+ ngx_ssl_connection_t *ssl;
#endif
- ngx_udp_connection_t *udp;
+ ngx_udp_connection_t *udp;
struct sockaddr *local_sockaddr;
socklen_t local_socklen;
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index 7ecdca0cb..ade35be73 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -12,23 +12,25 @@
#include <ngx_config.h>
-typedef struct ngx_module_s ngx_module_t;
-typedef struct ngx_conf_s ngx_conf_t;
-typedef struct ngx_cycle_s ngx_cycle_t;
-typedef struct ngx_pool_s ngx_pool_t;
-typedef struct ngx_chain_s ngx_chain_t;
-typedef struct ngx_log_s ngx_log_t;
-typedef struct ngx_open_file_s ngx_open_file_t;
-typedef struct ngx_command_s ngx_command_t;
-typedef struct ngx_file_s ngx_file_t;
-typedef struct ngx_event_s ngx_event_t;
-typedef struct ngx_event_aio_s ngx_event_aio_t;
-typedef struct ngx_connection_s ngx_connection_t;
-typedef struct ngx_thread_task_s ngx_thread_task_t;
-typedef struct ngx_ssl_s ngx_ssl_t;
-typedef struct ngx_proxy_protocol_s ngx_proxy_protocol_t;
-typedef struct ngx_ssl_connection_s ngx_ssl_connection_t;
-typedef struct ngx_udp_connection_s ngx_udp_connection_t;
+typedef struct ngx_module_s ngx_module_t;
+typedef struct ngx_conf_s ngx_conf_t;
+typedef struct ngx_cycle_s ngx_cycle_t;
+typedef struct ngx_pool_s ngx_pool_t;
+typedef struct ngx_chain_s ngx_chain_t;
+typedef struct ngx_log_s ngx_log_t;
+typedef struct ngx_open_file_s ngx_open_file_t;
+typedef struct ngx_command_s ngx_command_t;
+typedef struct ngx_file_s ngx_file_t;
+typedef struct ngx_event_s ngx_event_t;
+typedef struct ngx_event_aio_s ngx_event_aio_t;
+typedef struct ngx_connection_s ngx_connection_t;
+typedef struct ngx_thread_task_s ngx_thread_task_t;
+typedef struct ngx_ssl_s ngx_ssl_t;
+typedef struct ngx_proxy_protocol_s ngx_proxy_protocol_t;
+typedef struct ngx_quic_connection_s ngx_quic_connection_t;
+typedef struct ngx_quic_stream_s ngx_quic_stream_t;
+typedef struct ngx_ssl_connection_s ngx_ssl_connection_t;
+typedef struct ngx_udp_connection_s ngx_udp_connection_t;
typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
@@ -82,6 +84,9 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
#include <ngx_resolver.h>
#if (NGX_OPENSSL)
#include <ngx_event_openssl.h>
+#if (NGX_OPENSSL_QUIC)
+#include <ngx_event_quic.h>
+#endif
#endif
#include <ngx_process_cycle.h>
#include <ngx_conf_file.h>