Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-02-09 17:31:07 +0300
committerIgor Sysoev <igor@sysoev.ru>2005-02-09 17:31:07 +0300
commitaa8286101a57f11f2c1f9b5bf2d7ec121e74beea (patch)
treed87e4d87bf388c7a3c630170d9ba43a8591007ed /src/core
parent9ef28fa32a4713d365aa8d4cfc1f8732d6de47f6 (diff)
nginx-0.1.18-RELEASE importrelease-0.1.18
*) Workaround: the default values of the devpoll_events and the devpoll_changes directives changed from 512 to 32 to be compatible with Solaris 10. *) Bugfix: the proxy_set_x_var and fastcgi_set_var directives were not inherited. *) Bugfix: in the redirect rewrite directive the arguments were concatenated with URI by the "&" rather than the "?". *) Bugfix: the lines without trailing ";" in the file being included by the ngx_http_geo_module were silently ignored. *) Feature: the ngx_http_stub_status_module. *) Bugfix: the unknown log format in the access_log directive caused the segmentation fault. *) Feature: the new "document_root" parameter of the fastcgi_params directive. *) Feature: the fastcgi_redirect_errors directive. *) Feature: the new "break" modifier of the "rewrite" directive allows to stop the rewrite/location cycle and sets the current configuration to the request.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/core/ngx_conf_file.c22
-rw-r--r--src/core/ngx_connection.c1
-rw-r--r--src/core/ngx_inet.c2
-rw-r--r--src/core/ngx_radix_tree.c49
-rw-r--r--src/core/ngx_radix_tree.h7
6 files changed, 64 insertions, 19 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h
index c6afc4599..dbadb45ed 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.1.17"
+#define NGINX_VER "nginx/0.1.18"
#define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin"
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index e9cc24de5..436103a8c 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -48,7 +48,7 @@ static int argument_number[] = {
NGX_CONF_TAKE7
};
-static int ngx_conf_read_token(ngx_conf_t *cf);
+static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
@@ -337,7 +337,7 @@ char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
}
-static int ngx_conf_read_token(ngx_conf_t *cf)
+static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf)
{
u_char *start, ch, *src, *dst;
int len;
@@ -361,7 +361,17 @@ static int ngx_conf_read_token(ngx_conf_t *cf)
if (b->pos >= b->last) {
if (cf->conf_file->file.offset
- >= ngx_file_size(&cf->conf_file->file.info)) {
+ >= ngx_file_size(&cf->conf_file->file.info))
+ {
+ if (cf->args->nelts > 0) {
+ ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
+ "unexpected end of file in %s:%d, "
+ "expecting \";\" or \"}\"",
+ cf->conf_file->file.name.data,
+ cf->conf_file->line);
+ return NGX_ERROR;
+ }
+
return NGX_CONF_FILE_DONE;
}
@@ -418,7 +428,7 @@ static int ngx_conf_read_token(ngx_conf_t *cf)
}
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected '%c' in %s:%d",
+ "unexpected \"%c\" in %s:%d",
ch, cf->conf_file->file.name.data,
cf->conf_file->line);
@@ -438,7 +448,7 @@ static int ngx_conf_read_token(ngx_conf_t *cf)
case '{':
if (cf->args->nelts == 0) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected '%c' in %s:%d",
+ "unexpected \"%c\" in %s:%d",
ch, cf->conf_file->file.name.data,
cf->conf_file->line);
return NGX_ERROR;
@@ -453,7 +463,7 @@ static int ngx_conf_read_token(ngx_conf_t *cf)
case '}':
if (cf->args->nelts > 0) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected '}' in %s:%d",
+ "unexpected \"}\" in %s:%d",
cf->conf_file->file.name.data,
cf->conf_file->line);
return NGX_ERROR;
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index b3fa5de35..e8f06fdfd 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -397,7 +397,6 @@ void ngx_close_connection(ngx_connection_t *c)
}
-
ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
{
ngx_uint_t level;
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 56d2e98d3..a30ff035b 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -313,7 +313,7 @@ ngx_peers_t *ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u)
sin->sin_family = AF_INET;
sin->sin_port = u->port;
- sin->sin_addr.s_addr = *(in_addr_t *)(h->h_addr_list[i]);
+ sin->sin_addr.s_addr = *(in_addr_t *) (h->h_addr_list[i]);
peers->peer[i].sockaddr = (struct sockaddr *) sin;
peers->peer[i].socklen = sizeof(struct sockaddr_in);
diff --git a/src/core/ngx_radix_tree.c b/src/core/ngx_radix_tree.c
index 9493bab8a..e0ce095b0 100644
--- a/src/core/ngx_radix_tree.c
+++ b/src/core/ngx_radix_tree.c
@@ -11,8 +11,10 @@
static void *ngx_radix_alloc(ngx_radix_tree_t *tree);
-ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool)
+ngx_radix_tree_t *
+ngx_radix_tree_create(ngx_pool_t *pool, ngx_uint_t preallocate)
{
+ uint32_t key, mask, inc;
ngx_radix_tree_t *tree;
if (!(tree = ngx_palloc(pool, sizeof(ngx_radix_tree_t)))) {
@@ -33,12 +35,43 @@ ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool)
tree->root->parent = NULL;
tree->root->value = NGX_RADIX_NO_VALUE;
+ /*
+ * We preallocate the first nodes: 0, 1, 00, 01, 10, 11, 000, 001, etc.,
+ * to increase the TLB hits even if for the first lookup iterations.
+ * On the 32-bit platforms the 7 preallocated bits takes continuous 4K,
+ * 8 - 8K, 9 - 16K, etc.
+ */
+
+ mask = 0;
+ inc = 0x80000000;
+
+ while (preallocate--) {
+
+ key = 0;
+ mask >>= 1;
+ mask |= 0x80000000;
+
+ do {
+ if (ngx_radix32tree_insert(tree, key, mask, NGX_RADIX_NO_VALUE)
+ != NGX_OK)
+ {
+ return NULL;
+ }
+
+ key += inc;
+
+ } while (key);
+
+ inc >>= 1;
+ }
+
return tree;
}
-ngx_int_t ngx_radix32tree_insert(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask, uintptr_t value)
+ngx_int_t
+ngx_radix32tree_insert(ngx_radix_tree_t *tree, uint32_t key, uint32_t mask,
+ uintptr_t value)
{
uint32_t bit;
ngx_radix_node_t *node, *next;
@@ -100,8 +133,8 @@ ngx_int_t ngx_radix32tree_insert(ngx_radix_tree_t *tree,
}
-ngx_int_t ngx_radix32tree_delete(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask)
+ngx_int_t
+ngx_radix32tree_delete(ngx_radix_tree_t *tree, uint32_t key, uint32_t mask)
{
uint32_t bit;
ngx_radix_node_t *node;
@@ -158,7 +191,8 @@ ngx_int_t ngx_radix32tree_delete(ngx_radix_tree_t *tree,
}
-uintptr_t ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key)
+uintptr_t
+ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key)
{
uint32_t bit;
uintptr_t value;
@@ -187,7 +221,8 @@ uintptr_t ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key)
}
-static void *ngx_radix_alloc(ngx_radix_tree_t *tree)
+static void *
+ngx_radix_alloc(ngx_radix_tree_t *tree)
{
char *p;
diff --git a/src/core/ngx_radix_tree.h b/src/core/ngx_radix_tree.h
index c2d8a36a2..99c6eeaf2 100644
--- a/src/core/ngx_radix_tree.h
+++ b/src/core/ngx_radix_tree.h
@@ -33,11 +33,12 @@ typedef struct {
} ngx_radix_tree_t;
-ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool);
+ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool,
+ ngx_uint_t preallocate);
ngx_int_t ngx_radix32tree_insert(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask, uintptr_t value);
+ uint32_t key, uint32_t mask, uintptr_t value);
ngx_int_t ngx_radix32tree_delete(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask);
+ uint32_t key, uint32_t mask);
uintptr_t ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key);