diff src/os/unix/ngx_process_cycle.c @ 4953:5e9d5786ec06 stable-1.2

Merge of r4918: cache manager startup with many listen sockets. Fixed failure to start cache manager and cache loader processes if there were more than 512 listening sockets in configuration.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 10 Dec 2012 17:46:51 +0000
parents c355ca8f2b2c
children f941cf265cc5
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -1296,13 +1296,18 @@ ngx_cache_manager_process_cycle(ngx_cycl
     void         *ident[4];
     ngx_event_t   ev;
 
-    cycle->connection_n = 512;
-
+    /*
+     * Set correct process type since closing listening Unix domain socket
+     * in a master process also removes the Unix domain socket file.
+     */
     ngx_process = NGX_PROCESS_HELPER;
 
-    ngx_worker_process_init(cycle, -1);
+    ngx_close_listening_sockets(cycle);
 
-    ngx_close_listening_sockets(cycle);
+    /* Set a moderate number of connections for a helper process. */
+    cycle->connection_n = 512;
+
+    ngx_worker_process_init(cycle, -1);
 
     ngx_memzero(&ev, sizeof(ngx_event_t));
     ev.handler = ctx->handler;