Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_split_clients_module.c @ 668:9fbf3ad94cbf NGINX_1_1_18
nginx 1.1.18
*) Change: keepalive connections are no longer disabled for Safari by
default.
*) Feature: the $connection_requests variable.
*) Feature: $tcpinfo_rtt, $tcpinfo_rttvar, $tcpinfo_snd_cwnd and
$tcpinfo_rcv_space variables.
*) Feature: the "worker_cpu_affinity" directive now works on FreeBSD.
*) Feature: the "xslt_param" and "xslt_string_param" directives.
Thanks to Samuel Behan.
*) Bugfix: in configure tests.
Thanks to Piotr Sikora.
*) Bugfix: in the ngx_http_xslt_filter_module.
*) Bugfix: nginx could not be built on Debian GNU/Hurd.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 28 Mar 2012 00:00:00 +0400 |
parents | d0f7a625f27c |
children | f41d4b305d22 |
comparison
equal
deleted
inserted
replaced
667:e0eabdb2bad1 | 668:9fbf3ad94cbf |
---|---|
95 for (i = 0; i < ctx->parts.nelts; i++) { | 95 for (i = 0; i < ctx->parts.nelts; i++) { |
96 | 96 |
97 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 97 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
98 "http split: %uD %uD", hash, part[i].percent); | 98 "http split: %uD %uD", hash, part[i].percent); |
99 | 99 |
100 if (hash < part[i].percent) { | 100 if (hash < part[i].percent || part[i].percent == 0) { |
101 *v = part[i].value; | 101 *v = part[i].value; |
102 return NGX_OK; | 102 return NGX_OK; |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
109 | 109 |
110 static char * | 110 static char * |
111 ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 111 ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
112 { | 112 { |
113 char *rv; | 113 char *rv; |
114 uint32_t sum, last; | |
114 ngx_str_t *value, name; | 115 ngx_str_t *value, name; |
115 ngx_uint_t i, sum, last; | 116 ngx_uint_t i; |
116 ngx_conf_t save; | 117 ngx_conf_t save; |
117 ngx_http_variable_t *var; | 118 ngx_http_variable_t *var; |
118 ngx_http_split_clients_ctx_t *ctx; | 119 ngx_http_split_clients_ctx_t *ctx; |
119 ngx_http_split_clients_part_t *part; | 120 ngx_http_split_clients_part_t *part; |
120 ngx_http_compile_complex_value_t ccv; | 121 ngx_http_compile_complex_value_t ccv; |
173 part = ctx->parts.elts; | 174 part = ctx->parts.elts; |
174 | 175 |
175 for (i = 0; i < ctx->parts.nelts; i++) { | 176 for (i = 0; i < ctx->parts.nelts; i++) { |
176 sum = part[i].percent ? sum + part[i].percent : 10000; | 177 sum = part[i].percent ? sum + part[i].percent : 10000; |
177 if (sum > 10000) { | 178 if (sum > 10000) { |
178 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 179 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
179 "percent sum is more than 100%%"); | 180 "percent sum is more than 100%%"); |
180 return NGX_CONF_ERROR; | 181 return NGX_CONF_ERROR; |
181 } | 182 } |
182 | 183 |
183 if (part[i].percent) { | 184 if (part[i].percent) { |
184 part[i].percent = (uint32_t) | 185 last += part[i].percent * (uint64_t) 0xffffffff / 10000; |
185 (last + 0xffffffff / 10000 * part[i].percent); | 186 part[i].percent = last; |
186 } else { | 187 } |
187 part[i].percent = 0xffffffff; | |
188 } | |
189 | |
190 last = part[i].percent; | |
191 } | 188 } |
192 | 189 |
193 return rv; | 190 return rv; |
194 } | 191 } |
195 | 192 |