comparison src/core/ngx_cycle.c @ 316:a0beefedaf94

nginx-0.0.3-2004-04-15-00:34:05 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 14 Apr 2004 20:34:05 +0000
parents 11ff50a35d6d
children 1308b98496a2
comparison
equal deleted inserted replaced
315:39b6f2df45c0 316:a0beefedaf94
21 21
22 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) 22 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
23 { 23 {
24 void *rv; 24 void *rv;
25 ngx_uint_t i, n, failed; 25 ngx_uint_t i, n, failed;
26 ngx_log_t *log; 26 ngx_log_t *log, *new_log;
27 ngx_conf_t conf; 27 ngx_conf_t conf;
28 ngx_pool_t *pool; 28 ngx_pool_t *pool;
29 ngx_cycle_t *cycle, **old; 29 ngx_cycle_t *cycle, **old;
30 ngx_socket_t fd; 30 ngx_socket_t fd;
31 ngx_open_file_t *file; 31 ngx_open_file_t *file;
42 ngx_destroy_pool(pool); 42 ngx_destroy_pool(pool);
43 return NULL; 43 return NULL;
44 } 44 }
45 cycle->pool = pool; 45 cycle->pool = pool;
46 46
47 pool->log = log;
48 cycle->log = log;
49
47 cycle->old_cycle = old_cycle; 50 cycle->old_cycle = old_cycle;
48 cycle->conf_file = old_cycle->conf_file; 51 cycle->conf_file = old_cycle->conf_file;
49 52
50 53
51 n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10; 54 n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10;
69 cycle->open_files.size = sizeof(ngx_open_file_t); 72 cycle->open_files.size = sizeof(ngx_open_file_t);
70 cycle->open_files.nalloc = n; 73 cycle->open_files.nalloc = n;
71 cycle->open_files.pool = pool; 74 cycle->open_files.pool = pool;
72 75
73 76
74 if (!(cycle->log = ngx_log_create_errlog(cycle, NULL))) { 77 if (!(new_log = ngx_log_create_errlog(cycle, NULL))) {
75 ngx_destroy_pool(pool); 78 ngx_destroy_pool(pool);
76 return NULL; 79 return NULL;
77 } 80 }
78 81
79 82
127 /* STUB */ conf.pool = cycle->pool; 130 /* STUB */ conf.pool = cycle->pool;
128 conf.log = log; 131 conf.log = log;
129 conf.module_type = NGX_CORE_MODULE; 132 conf.module_type = NGX_CORE_MODULE;
130 conf.cmd_type = NGX_MAIN_CONF; 133 conf.cmd_type = NGX_MAIN_CONF;
131 134
135 cycle->log = new_log;
132 136
133 if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) { 137 if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
134 ngx_destroy_pool(pool); 138 ngx_destroy_pool(pool);
135 return NULL; 139 return NULL;
136 } 140 }
137 141
142 cycle->log = log;
138 143
139 for (i = 0; ngx_modules[i]; i++) { 144 for (i = 0; ngx_modules[i]; i++) {
140 if (ngx_modules[i]->type != NGX_CORE_MODULE) { 145 if (ngx_modules[i]->type != NGX_CORE_MODULE) {
141 continue; 146 continue;
142 } 147 }
201 } 206 }
202 #endif 207 #endif
203 } 208 }
204 } 209 }
205 210
211 cycle->log = new_log;
212 pool->log = new_log;
206 213
207 if (!failed) { 214 if (!failed) {
208 if (old_cycle->listening.nelts) { 215 if (old_cycle->listening.nelts) {
209 ls = old_cycle->listening.elts; 216 ls = old_cycle->listening.elts;
210 for (i = 0; i < old_cycle->listening.nelts; i++) { 217 for (i = 0; i < old_cycle->listening.nelts; i++) {