comparison src/http/ngx_http_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 b55cbf18157e
children
comparison
equal deleted inserted replaced
339:d19550b67059 340:10cc350ed8a1
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 #include <ngx_http.h> 9 #include <ngx_http.h>
10 10
11 11
12 12
13 static int ngx_http_busy_lock_look_cachable(ngx_http_busy_lock_t *bl, 13 static int ngx_http_busy_lock_look_cacheable(ngx_http_busy_lock_t *bl,
14 ngx_http_busy_lock_ctx_t *bc, 14 ngx_http_busy_lock_ctx_t *bc,
15 int lock); 15 int lock);
16 16
17 17
18 int ngx_http_busy_lock(ngx_http_busy_lock_t *bl, ngx_http_busy_lock_ctx_t *bc) 18 int ngx_http_busy_lock(ngx_http_busy_lock_t *bl, ngx_http_busy_lock_ctx_t *bc)
19 { 19 {
20 if (bl->busy < bl->max_busy) { 20 if (bl->busy < bl->max_busy) {
58 58
59 return NGX_ERROR; 59 return NGX_ERROR;
60 } 60 }
61 61
62 62
63 int ngx_http_busy_lock_cachable(ngx_http_busy_lock_t *bl, 63 int ngx_http_busy_lock_cacheable(ngx_http_busy_lock_t *bl,
64 ngx_http_busy_lock_ctx_t *bc, int lock) 64 ngx_http_busy_lock_ctx_t *bc, int lock)
65 { 65 {
66 int rc; 66 int rc;
67 67
68 rc = ngx_http_busy_lock_look_cachable(bl, bc, lock); 68 rc = ngx_http_busy_lock_look_cacheable(bl, bc, lock);
69 69
70 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, bc->event->log, 0, 70 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, bc->event->log, 0,
71 "http busylock: %d w:%d mw::%d", 71 "http busylock: %d w:%d mw::%d",
72 rc, bl->waiting, bl->max_waiting); 72 rc, bl->waiting, bl->max_waiting);
73 73
119 return; 119 return;
120 } 120 }
121 121
122 if (bl->md5) { 122 if (bl->md5) {
123 bl->md5_mask[bc->slot / 8] &= ~(1 << (bc->slot & 7)); 123 bl->md5_mask[bc->slot / 8] &= ~(1 << (bc->slot & 7));
124 bl->cachable--; 124 bl->cacheable--;
125 } 125 }
126 126
127 bl->busy--; 127 bl->busy--;
128 } 128 }
129 129
130 130
131 static int ngx_http_busy_lock_look_cachable(ngx_http_busy_lock_t *bl, 131 static int ngx_http_busy_lock_look_cacheable(ngx_http_busy_lock_t *bl,
132 ngx_http_busy_lock_ctx_t *bc, 132 ngx_http_busy_lock_ctx_t *bc,
133 int lock) 133 int lock)
134 { 134 {
135 int i, b, cachable, free; 135 int i, b, cacheable, free;
136 u_int mask; 136 u_int mask;
137 137
138 b = 0; 138 b = 0;
139 cachable = 0; 139 cacheable = 0;
140 free = -1; 140 free = -1;
141 141
142 #if (NGX_SUPPRESS_WARN) 142 #if (NGX_SUPPRESS_WARN)
143 mask = 0; 143 mask = 0;
144 #endif 144 #endif
151 151
152 if (mask & 1) { 152 if (mask & 1) {
153 if (ngx_memcmp(&bl->md5[i * 16], bc->md5, 16) == 0) { 153 if (ngx_memcmp(&bl->md5[i * 16], bc->md5, 16) == 0) {
154 return NGX_AGAIN; 154 return NGX_AGAIN;
155 } 155 }
156 cachable++; 156 cacheable++;
157 157
158 } else if (free == -1) { 158 } else if (free == -1) {
159 free = i; 159 free = i;
160 } 160 }
161 161
162 #if 1 162 #if 1
163 if (cachable == bl->cachable) { 163 if (cacheable == bl->cacheable) {
164 if (free == -1 && cachable < bl->max_busy) { 164 if (free == -1 && cacheable < bl->max_busy) {
165 free = i + 1; 165 free = i + 1;
166 } 166 }
167 167
168 break; 168 break;
169 } 169 }
184 184
185 ngx_memcpy(&bl->md5[free * 16], bc->md5, 16); 185 ngx_memcpy(&bl->md5[free * 16], bc->md5, 16);
186 bl->md5_mask[free / 8] |= 1 << (free & 7); 186 bl->md5_mask[free / 8] |= 1 << (free & 7);
187 bc->slot = free; 187 bc->slot = free;
188 188
189 bl->cachable++; 189 bl->cacheable++;
190 bl->busy++; 190 bl->busy++;
191 } 191 }
192 192
193 return NGX_OK; 193 return NGX_OK;
194 } 194 }