nginx-0.0.1-2003-12-09-18:08:11 import
diff --git a/src/core/nginx.c b/src/core/nginx.c index d52933a..e02866e 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c
@@ -24,14 +24,14 @@ static ngx_command_t ngx_core_commands[] = { - {ngx_string("daemon"), - NGX_MAIN_CONF|NGX_CONF_TAKE1, - ngx_conf_set_core_flag_slot, - 0, - offsetof(ngx_core_conf_t, daemon), - NULL}, + { ngx_string("daemon"), + NGX_MAIN_CONF|NGX_CONF_TAKE1, + ngx_conf_set_core_flag_slot, + 0, + offsetof(ngx_core_conf_t, daemon), + NULL }, - ngx_null_command + ngx_null_command }; @@ -238,6 +238,7 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log) { int i, n, failed; + ngx_fd_t fd; ngx_str_t conf_file; ngx_conf_t conf; ngx_pool_t *pool; @@ -390,6 +391,26 @@ if (ngx_memcmp(nls[n].sockaddr, ls[i].sockaddr, ls[i].socklen) == 0) { + fd = ls[i].fd; +#if (WIN32) + /* + * Winsock assignes a socket number divisible by 4 so + * to find a connection we divide a socket number by 4. + */ + + fd /= 4; +#endif + if (fd >= cycle->connection_n) { + ngx_log_error(NGX_LOG_EMERG, log, 0, + "%d connections is not enough to hold " + "an open listening socket on %s, " + "required at least %d connections", + cycle->connection_n, + ls[i].addr_text.data, fd); + failed = 1; + break; + } + nls[n].fd = ls[i].fd; nls[i].remain = 1; ls[i].remain = 1; @@ -409,8 +430,10 @@ } } - if (ngx_open_listening_sockets(cycle, log) == NGX_ERROR) { - failed = 1; + if (!failed) { + if (ngx_open_listening_sockets(cycle, log) == NGX_ERROR) { + failed = 1; + } } } @@ -583,7 +606,7 @@ if (s == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, - ngx_socket_n " %s falied", ls[i].addr_text.data); + ngx_socket_n " %s failed", ls[i].addr_text.data); return NGX_ERROR; }
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index 8689457..2492390 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c
@@ -230,7 +230,7 @@ } else { ngx_log_error(NGX_LOG_EMERG, cf->log, 0, - "\"%s\" directive %s in %s:%d", + "the \"%s\" directive %s in %s:%d", name->data, rv, cf->conf_file->file.name.data, cf->conf_file->line);
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h index eb5478e..eb9e63b 100644 --- a/src/core/ngx_conf_file.h +++ b/src/core/ngx_conf_file.h
@@ -179,6 +179,11 @@ conf = default; \ } +#define ngx_conf_init_ptr_value(conf, default) \ + if (conf == (void *) NGX_CONF_UNSET) { \ + conf = default; \ + } + #define ngx_conf_init_unsigned_value(conf, default) \ if (conf == (unsigned) NGX_CONF_UNSET) { \ conf = default; \
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c index b615c7e..fede0a0 100644 --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c
@@ -323,7 +323,7 @@ } d = NGX_LOG_DEBUG_FIRST; - for (n = 0; n < /* STUB */ 3; n++) { + for (n = 0; n < /* STUB */ 4; n++) { if (ngx_strcmp(value[i].data, debug_levels[n]) == 0) { if (cf->cycle->log->log_level & ~NGX_LOG_DEBUG_ALL) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, @@ -333,9 +333,9 @@ } cf->cycle->log->log_level |= d; - d <<= 1; - continue; } + + d <<= 1; }
diff --git a/src/core/ngx_rbtree.h b/src/core/ngx_rbtree.h index db435ff..04d7622 100644 --- a/src/core/ngx_rbtree.h +++ b/src/core/ngx_rbtree.h
@@ -23,14 +23,14 @@ ngx_rbtree_t *node); -ngx_inline static ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *root, +ngx_inline static ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *node, ngx_rbtree_t *sentinel) { - while (root->left != sentinel) { - root = root->left; + while (node->left != sentinel) { + node = node->left; } - return root; + return node; }