mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
upgraded the nginx core to 1.19.9. (#717)
This commit is contained in:
38
patches/nginx-1.19.9-reuseport_close_unused_fds.patch
Normal file
38
patches/nginx-1.19.9-reuseport_close_unused_fds.patch
Normal file
@ -0,0 +1,38 @@
|
||||
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
|
||||
--- a/src/core/ngx_connection.c
|
||||
+++ b/src/core/ngx_connection.c
|
||||
@@ -1118,6 +1118,12 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
|
||||
ls = cycle->listening.elts;
|
||||
for (i = 0; i < cycle->listening.nelts; i++) {
|
||||
|
||||
+#if (NGX_HAVE_REUSEPORT)
|
||||
+ if (ls[i].fd == (ngx_socket_t) -1) {
|
||||
+ continue;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
c = ls[i].connection;
|
||||
|
||||
if (c) {
|
||||
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
|
||||
--- a/src/event/ngx_event.c
|
||||
+++ b/src/event/ngx_event.c
|
||||
@@ -775,6 +775,18 @@ ngx_event_process_init(ngx_cycle_t *cycle)
|
||||
|
||||
#if (NGX_HAVE_REUSEPORT)
|
||||
if (ls[i].reuseport && ls[i].worker != ngx_worker) {
|
||||
+ ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
|
||||
+ "closing unused fd:%d listening on %V",
|
||||
+ ls[i].fd, &ls[i].addr_text);
|
||||
+
|
||||
+ if (ngx_close_socket(ls[i].fd) == -1) {
|
||||
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
|
||||
+ ngx_close_socket_n " %V failed",
|
||||
+ &ls[i].addr_text);
|
||||
+ }
|
||||
+
|
||||
+ ls[i].fd = (ngx_socket_t) -1;
|
||||
+
|
||||
continue;
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user