nginx-0.0.3-2004-04-15-19:34:36 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index a784040..5f2603c 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -70,12 +70,14 @@
};
-ngx_int_t ngx_max_module;
+ngx_int_t ngx_max_module;
-ngx_int_t ngx_process;
-ngx_pid_t ngx_pid;
-ngx_pid_t ngx_new_binary;
-ngx_int_t ngx_inherited;
+ngx_int_t ngx_process;
+ngx_pid_t ngx_pid;
+ngx_pid_t ngx_new_binary;
+ngx_int_t ngx_inherited;
+
+ngx_uint_t ngx_test_config;
int main(int argc, char *const *argv)
@@ -125,11 +127,6 @@
return 1;
}
- ngx_max_module = 0;
- for (i = 0; ngx_modules[i]; i++) {
- ngx_modules[i]->index = ngx_max_module++;
- }
-
if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
return 1;
}
@@ -138,11 +135,20 @@
return 1;
}
+ ngx_max_module = 0;
+ for (i = 0; ngx_modules[i]; i++) {
+ ngx_modules[i]->index = ngx_max_module++;
+ }
+
cycle = ngx_init_cycle(&init_cycle);
if (cycle == NULL) {
return 1;
}
+ if (ngx_test_config) {
+ return 0;
+ }
+
ngx_cycle = cycle;
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
@@ -276,6 +282,10 @@
switch (ctx->argv[i][1]) {
+ case 't':
+ ngx_test_config = 1;
+ break;
+
case 'c':
if (ctx->argv[i + 1] == NULL) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 8dedbd1..6382ec1 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -228,7 +228,17 @@
fd /= 4;
#endif
- ngx_del_event(&cycle->read_events[fd], NGX_READ_EVENT, NGX_CLOSE_EVENT);
+ if (ngx_event_flags & NGX_USE_SIGIO_EVENT) {
+ if (cycle->connections[fd].read->active) {
+ ngx_del_conn(&cycle->connections[fd], NGX_CLOSE_EVENT);
+ }
+
+ } else {
+ if (cycle->read_events[fd].active) {
+ ngx_del_event(&cycle->read_events[fd],
+ NGX_READ_EVENT, NGX_CLOSE_EVENT);
+ }
+ }
if (ngx_close_socket(ls[i].fd) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 077b120..71a0b00 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -23,7 +23,7 @@
{
void *rv;
ngx_uint_t i, n, failed;
- ngx_log_t *log, *new_log;
+ ngx_log_t *log;
ngx_conf_t conf;
ngx_pool_t *pool;
ngx_cycle_t *cycle, **old;
@@ -37,16 +37,14 @@
if (!(pool = ngx_create_pool(16 * 1024, log))) {
return NULL;
}
+ pool->log = log;
if (!(cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t)))) {
ngx_destroy_pool(pool);
return NULL;
}
cycle->pool = pool;
-
- pool->log = log;
cycle->log = log;
-
cycle->old_cycle = old_cycle;
cycle->conf_file = old_cycle->conf_file;
@@ -74,7 +72,7 @@
cycle->open_files.pool = pool;
- if (!(new_log = ngx_log_create_errlog(cycle, NULL))) {
+ if (!(cycle->new_log = ngx_log_create_errlog(cycle, NULL))) {
ngx_destroy_pool(pool);
return NULL;
}
@@ -127,19 +125,17 @@
conf.ctx = cycle->conf_ctx;
conf.cycle = cycle;
- /* STUB */ conf.pool = cycle->pool;
+ conf.pool = pool;
conf.log = log;
conf.module_type = NGX_CORE_MODULE;
conf.cmd_type = NGX_MAIN_CONF;
- cycle->log = new_log;
if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
ngx_destroy_pool(pool);
return NULL;
}
- cycle->log = log;
for (i = 0; ngx_modules[i]; i++) {
if (ngx_modules[i]->type != NGX_CORE_MODULE) {
@@ -208,8 +204,8 @@
}
}
- cycle->log = new_log;
- pool->log = new_log;
+ cycle->log = cycle->new_log;
+ pool->log = cycle->new_log;
if (!failed) {
if (old_cycle->listening.nelts) {
diff --git a/src/core/ngx_cycle.h b/src/core/ngx_cycle.h
index 1fac10e..3cecbc5 100644
--- a/src/core/ngx_cycle.h
+++ b/src/core/ngx_cycle.h
@@ -9,7 +9,10 @@
struct ngx_cycle_s {
void ****conf_ctx;
ngx_pool_t *pool;
+
ngx_log_t *log;
+ ngx_log_t *new_log;
+
ngx_array_t listening;
ngx_array_t open_files;
ngx_array_t pathes;
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index ace7f33..531c860 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -311,23 +311,6 @@
}
-static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_str_t *value;
-
- value = cf->args->elts;
-
- if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) {
- cf->cycle->log->file = &ngx_stderr;
-
- } else {
- cf->cycle->log->file->name = value[1];
- }
-
- return ngx_set_error_log_levels(cf, cf->cycle->log);
-}
-
-
char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log)
{
ngx_uint_t i, n, d;
@@ -379,3 +362,20 @@
return NGX_CONF_OK;
}
+
+
+static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_str_t *value;
+
+ value = cf->args->elts;
+
+ if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) {
+ cf->cycle->new_log->file = &ngx_stderr;
+
+ } else {
+ cf->cycle->new_log->file->name = value[1];
+ }
+
+ return ngx_set_error_log_levels(cf, cf->cycle->new_log);
+}