diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nginx.h | 2 | ||||
-rw-r--r-- | src/core/ngx_conf_file.c | 2 | ||||
-rw-r--r-- | src/core/ngx_config.h | 2 | ||||
-rw-r--r-- | src/core/ngx_connection.c | 30 | ||||
-rw-r--r-- | src/core/ngx_cycle.c | 4 | ||||
-rw-r--r-- | src/core/ngx_cycle.h | 6 | ||||
-rw-r--r-- | src/core/ngx_file.c | 2 | ||||
-rw-r--r-- | src/core/ngx_file.h | 2 | ||||
-rw-r--r-- | src/core/ngx_inet.c | 4 | ||||
-rw-r--r-- | src/core/ngx_string.c | 11 |
10 files changed, 48 insertions, 17 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h index 22c632ff3..67e8e6b02 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.3.1" +#define NGINX_VER "nginx/0.3.2" #define NGINX_VAR "NGINX" #define NGX_OLDPID_EXT ".oldbin" diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index 110c9e2b7..0e671ef3a 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -660,7 +660,7 @@ ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name) name->len = cycle->root.len + old.len; - if (cycle->connections0) { + if (cycle->connections) { name->data = ngx_palloc(cycle->pool, name->len + 1); if (name->data == NULL) { return NGX_ERROR; diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h index 4045e7a82..7c5687e1b 100644 --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -106,7 +106,7 @@ typedef long ngx_flag_t; /* TODO: auto_conf: ngx_inline inline __inline __inline__ */ #ifndef ngx_inline -#define ngx_inline __inline +#define ngx_inline inline #endif #define NGX_ACCEPT_THRESHOLD 100 diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index a7371bf89..3f36d3155 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -372,7 +372,9 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle) ngx_connection_t * ngx_get_connection(ngx_socket_t s, ngx_log_t *log) { - ngx_connection_t *c; + ngx_uint_t instance; + ngx_event_t *rev, *wev; + ngx_connection_t *c; /* disable warning: Win32 SOCKET is u_int while UNIX socket is int */ @@ -407,6 +409,32 @@ ngx_get_connection(ngx_socket_t s, ngx_log_t *log) ngx_cycle->files[s] = c; } + rev = c->read; + wev = c->write; + + ngx_memzero(c, sizeof(ngx_connection_t)); + + c->read = rev; + c->write = wev; + c->fd = s; + c->log = log; + + instance = rev->instance; + + ngx_memzero(rev, sizeof(ngx_event_t)); + ngx_memzero(wev, sizeof(ngx_event_t)); + + rev->instance = !instance; + wev->instance = !instance; + + rev->index = NGX_INVALID_INDEX; + wev->index = NGX_INVALID_INDEX; + + rev->data = c; + wev->data = c; + + wev->write = 1; + return c; } diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index 839843f2b..d8f95fa4d 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -627,7 +627,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) } } - if (old_cycle->connections0 == NULL) { + if (old_cycle->connections == NULL) { /* an old cycle is an init cycle */ ngx_destroy_pool(old_cycle->pool); return cycle; @@ -959,7 +959,7 @@ static void ngx_clean_old_cycles(ngx_event_t *ev) found = 0; for (n = 0; n < cycle[i]->connection_n; n++) { - if (cycle[i]->connections0[n].fd != (ngx_socket_t) -1) { + if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) { found = 1; ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n); diff --git a/src/core/ngx_cycle.h b/src/core/ngx_cycle.h index bf1d43092..a94444a91 100644 --- a/src/core/ngx_cycle.h +++ b/src/core/ngx_cycle.h @@ -39,9 +39,9 @@ struct ngx_cycle_s { ngx_uint_t connection_n; ngx_uint_t files_n; - ngx_connection_t *connections0; - ngx_event_t *read_events0; - ngx_event_t *write_events0; + ngx_connection_t *connections; + ngx_event_t *read_events; + ngx_event_t *write_events; ngx_cycle_t *old_cycle; diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c index efabd39b8..76e71c748 100644 --- a/src/core/ngx_file.c +++ b/src/core/ngx_file.c @@ -36,7 +36,7 @@ ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain) ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool, - int persistent) + ngx_uint_t persistent) { ngx_err_t err; ngx_atomic_uint_t n; diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h index 1efee294e..52c1ae22d 100644 --- a/src/core/ngx_file.h +++ b/src/core/ngx_file.h @@ -55,7 +55,7 @@ typedef struct { ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain); ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, - ngx_pool_t *pool, int persistent); + ngx_pool_t *pool, ngx_uint_t persistent); void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path); ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path); ngx_int_t ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot); diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 376aaaefa..60a40eca4 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -343,10 +343,6 @@ ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u) peers->peer[i].name.len = len + u->port_text.len; peers->peer[i].uri_separator = ""; - - peers->peer[i].weight = 1; - peers->peer[i].max_fails = 1; - peers->peer[i].fail_timeout = 10; } } else { diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index 93449abcc..1164cc445 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -115,6 +115,7 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) uint32_t ui32; int64_t i64; uint64_t ui64; + ngx_msec_t ms; ngx_str_t *s; ngx_uint_t width, sign, hexadecimal, max_width; static u_char hex[] = "0123456789abcdef"; @@ -221,8 +222,14 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) break; case 'M': - ui64 = (uint64_t) va_arg(args, ngx_msec_t); - sign = 0; + ms = (ngx_msec_t) va_arg(args, ngx_msec_t); + if ((ngx_msec_int_t) ms == -1) { + sign = 1; + i64 = -1; + } else { + sign = 0; + ui64 = (uint64_t) ms; + } break; case 'z': |