comparison src/event/ngx_event_busy_lock.c @ 340:10cc350ed8a1 NGINX_0_6_14

nginx 0.6.14 *) Change: now by default the "echo" SSI command uses entity encoding. *) Feature: the "encoding" parameter in the "echo" SSI command. *) Feature: the "access_log" directive may be used inside the "limit_except" block. *) Bugfix: if all upstream servers were failed, then all servers had got weight the was equal one until servers became alive; bug appeared in 0.6.6. *) Bugfix: a segmentation fault occurred in worker process if $date_local and $date_gmt were used outside the ngx_http_ssi_filter_module. *) Bugfix: a segmentation fault might occur in worker process if debug log was enabled. Thanks to Andrei Nigmatulin. *) Bugfix: ngx_http_memcached_module did not set $upstream_response_time. Thanks to Maxim Dounin. *) Bugfix: a worker process may got caught in an endless loop, if the memcached was used. *) Bugfix: nginx supported low case only "close" and "keep-alive" values in the "Connection" request header line; bug appeared in 0.6.11. *) Bugfix: sub_filter did not work with empty substitution. *) Bugfix: in sub_filter parsing.
author Igor Sysoev <http://sysoev.ru>
date Mon, 15 Oct 2007 00:00:00 +0400
parents f7cd062ee035
children
comparison
equal deleted inserted replaced
339:d19550b67059 340:10cc350ed8a1
7 #include <ngx_config.h> 7 #include <ngx_config.h>
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 #include <ngx_event.h> 9 #include <ngx_event.h>
10 10
11 11
12 static ngx_int_t ngx_event_busy_lock_look_cachable(ngx_event_busy_lock_t *bl, 12 static ngx_int_t ngx_event_busy_lock_look_cacheable(ngx_event_busy_lock_t *bl,
13 ngx_event_busy_lock_ctx_t *ctx); 13 ngx_event_busy_lock_ctx_t *ctx);
14 static void ngx_event_busy_lock_handler(ngx_event_t *ev); 14 static void ngx_event_busy_lock_handler(ngx_event_t *ev);
15 static void ngx_event_busy_lock_posted_handler(ngx_event_t *ev); 15 static void ngx_event_busy_lock_posted_handler(ngx_event_t *ev);
16 16
17 17
63 return rc; 63 return rc;
64 } 64 }
65 65
66 66
67 ngx_int_t 67 ngx_int_t
68 ngx_event_busy_lock_cachable(ngx_event_busy_lock_t *bl, 68 ngx_event_busy_lock_cacheable(ngx_event_busy_lock_t *bl,
69 ngx_event_busy_lock_ctx_t *ctx) 69 ngx_event_busy_lock_ctx_t *ctx)
70 { 70 {
71 ngx_int_t rc; 71 ngx_int_t rc;
72 72
73 ngx_mutex_lock(bl->mutex); 73 ngx_mutex_lock(bl->mutex);
74 74
75 rc = ngx_event_busy_lock_look_cachable(bl, ctx); 75 rc = ngx_event_busy_lock_look_cacheable(bl, ctx);
76 76
77 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ctx->event->log, 0, 77 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ctx->event->log, 0,
78 "event busy lock: %d w:%d mw:%d", 78 "event busy lock: %d w:%d mw:%d",
79 rc, bl->waiting, bl->max_waiting); 79 rc, bl->waiting, bl->max_waiting);
80 80
199 ngx_mutex_unlock(bl->mutex); 199 ngx_mutex_unlock(bl->mutex);
200 } 200 }
201 201
202 202
203 static ngx_int_t 203 static ngx_int_t
204 ngx_event_busy_lock_look_cachable(ngx_event_busy_lock_t *bl, 204 ngx_event_busy_lock_look_cacheable(ngx_event_busy_lock_t *bl,
205 ngx_event_busy_lock_ctx_t *ctx) 205 ngx_event_busy_lock_ctx_t *ctx)
206 { 206 {
207 ngx_int_t free; 207 ngx_int_t free;
208 ngx_uint_t i, bit, cachable, mask; 208 ngx_uint_t i, bit, cacheable, mask;
209 209
210 bit = 0; 210 bit = 0;
211 cachable = 0; 211 cacheable = 0;
212 free = -1; 212 free = -1;
213 213
214 #if (NGX_SUPPRESS_WARN) 214 #if (NGX_SUPPRESS_WARN)
215 mask = 0; 215 mask = 0;
216 #endif 216 #endif
225 if (ngx_memcmp(&bl->md5[i * 16], ctx->md5, 16) == 0) { 225 if (ngx_memcmp(&bl->md5[i * 16], ctx->md5, 16) == 0) {
226 ctx->waiting = 1; 226 ctx->waiting = 1;
227 ctx->slot = i; 227 ctx->slot = i;
228 return NGX_AGAIN; 228 return NGX_AGAIN;
229 } 229 }
230 cachable++; 230 cacheable++;
231 231
232 } else if (free == -1) { 232 } else if (free == -1) {
233 free = i; 233 free = i;
234 } 234 }
235 235
236 if (cachable == bl->cachable) { 236 if (cacheable == bl->cacheable) {
237 if (free == -1 && cachable < bl->max_busy) { 237 if (free == -1 && cacheable < bl->max_busy) {
238 free = i + 1; 238 free = i + 1;
239 } 239 }
240 240
241 break; 241 break;
242 } 242 }
257 257
258 ngx_memcpy(&bl->md5[free * 16], ctx->md5, 16); 258 ngx_memcpy(&bl->md5[free * 16], ctx->md5, 16);
259 bl->md5_mask[free / 8] |= 1 << (free & 7); 259 bl->md5_mask[free / 8] |= 1 << (free & 7);
260 ctx->slot = free; 260 ctx->slot = free;
261 261
262 bl->cachable++; 262 bl->cacheable++;
263 bl->busy++; 263 bl->busy++;
264 264
265 return NGX_OK; 265 return NGX_OK;
266 } 266 }
267 267