diff src/core/ngx_cycle.c @ 86:962c43960644 NGINX_0_1_43

nginx 0.1.43 *) Feature: the listen(2) backlog in the "listen" directive can be changed using the -HUP signal. *) Feature: the geo2nginx.pl script was added to contrib. *) Change: the FastCGI parameters with the empty values now are passed to a server. *) Bugfix: the segmentation fault occurred or the worker process may got caught in an endless loop if the proxied or FastCGI server sent the "Cache-Control" header line and the "expires" directive was used; in the proxied mode the bug appeared in 0.1.29.
author Igor Sysoev <http://sysoev.ru>
date Tue, 30 Aug 2005 00:00:00 +0400
parents 77969b24f355
children 45945fa8b8ba
line wrap: on
line diff
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -339,6 +339,10 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
                         nls[n].remain = 1;
                         ls[i].remain = 1;
 
+                        if (ls[n].backlog != nls[i].backlog) {
+                            nls[n].change_backlog = 1;
+                        }
+
 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
 
                         /*
@@ -405,12 +409,21 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
                 failed = 1;
             }
 
-#if (NGX_HAVE_DEFERRED_ACCEPT)
-
             if (!failed) {
                 ls = cycle->listening.elts;
                 for (i = 0; i < cycle->listening.nelts; i++) {
 
+                    if (ls[i].change_backlog) {
+                        if (listen(ls[i].fd, ls[i].backlog) == -1) {
+                            ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno,
+                                          "changing the listen() backlog to %d "
+                                          "for %V failed, ignored",
+                                          &ls[i].addr_text, ls[i].backlog);
+                        }
+                    }
+
+#if (NGX_HAVE_DEFERRED_ACCEPT)
+
 #ifdef SO_ACCEPTFILTER
                     if (ls[i].delete_deferred) {
                         if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER,
@@ -476,9 +489,9 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t 
                         ls[i].deferred_accept = 1;
                     }
 #endif
+#endif
                 }
             }
-#endif
         }
     }