Mercurial > hg > nginx
comparison src/event/ngx_event_accept.c @ 266:5238e93961a1
nginx-0.0.2-2004-02-23-23:57:12 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 23 Feb 2004 20:57:12 +0000 |
parents | 5dacbb4daaf6 |
children | 87e73f067470 |
comparison
equal
deleted
inserted
replaced
265:6468241715e6 | 266:5238e93961a1 |
---|---|
252 rev->log = log; | 252 rev->log = log; |
253 wev->log = log; | 253 wev->log = log; |
254 | 254 |
255 /* | 255 /* |
256 * TODO: MT: - atomic increment (x86: lock xadd) | 256 * TODO: MT: - atomic increment (x86: lock xadd) |
257 * or protection by critical section or mutex | 257 * or protection by critical section or light mutex |
258 * | 258 * |
259 * TODO: MP: - allocated in a shared memory | 259 * TODO: MP: - allocated in a shared memory |
260 * - atomic increment (x86: lock xadd) | 260 * - atomic increment (x86: lock xadd) |
261 * or protection by critical section or mutex | 261 * or protection by critical section or light mutex |
262 */ | 262 */ |
263 | 263 |
264 c->number = ngx_connection_counter++; | 264 c->number = ngx_atomic_inc(&ngx_connection_counter); |
265 | 265 |
266 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, | 266 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
267 "accept: %d, %d", s, c->number); | 267 "accept: fd:%d c:%d", s, c->number); |
268 | 268 |
269 if (ngx_add_conn) { | 269 if (ngx_add_conn) { |
270 if (ngx_add_conn(c) == NGX_ERROR) { | 270 if (ngx_add_conn(c) == NGX_ERROR) { |
271 if (ngx_close_socket(s) == -1) { | 271 if (ngx_close_socket(s) == -1) { |
272 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | 272 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, |
290 } | 290 } |
291 | 291 |
292 accepted++; | 292 accepted++; |
293 | 293 |
294 } while (ev->available); | 294 } while (ev->available); |
295 | |
296 return; | |
297 } | 295 } |
298 | 296 |
299 | 297 |
300 static size_t ngx_accept_log_error(void *data, char *buf, size_t len) | 298 static size_t ngx_accept_log_error(void *data, char *buf, size_t len) |
301 { | 299 { |