comparison src/core/ngx_connection.c @ 110:dad2fe8ecf08 NGINX_0_3_2

nginx 0.3.2 *) Feature: the Sun Studio 10 C compiler support. *) Feature: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", and "fastcgi_upstream_fail_timeout" directives.
author Igor Sysoev <http://sysoev.ru>
date Wed, 12 Oct 2005 00:00:00 +0400
parents 45945fa8b8ba
children 408f195b3482
comparison
equal deleted inserted replaced
109:97da525033a1 110:dad2fe8ecf08
370 370
371 371
372 ngx_connection_t * 372 ngx_connection_t *
373 ngx_get_connection(ngx_socket_t s, ngx_log_t *log) 373 ngx_get_connection(ngx_socket_t s, ngx_log_t *log)
374 { 374 {
375 ngx_connection_t *c; 375 ngx_uint_t instance;
376 ngx_event_t *rev, *wev;
377 ngx_connection_t *c;
376 378
377 /* disable warning: Win32 SOCKET is u_int while UNIX socket is int */ 379 /* disable warning: Win32 SOCKET is u_int while UNIX socket is int */
378 380
379 if (ngx_cycle->files && (ngx_uint_t) s >= ngx_cycle->files_n) { 381 if (ngx_cycle->files && (ngx_uint_t) s >= ngx_cycle->files_n) {
380 ngx_log_error(NGX_LOG_ALERT, log, 0, 382 ngx_log_error(NGX_LOG_ALERT, log, 0,
405 407
406 if (ngx_cycle->files) { 408 if (ngx_cycle->files) {
407 ngx_cycle->files[s] = c; 409 ngx_cycle->files[s] = c;
408 } 410 }
409 411
412 rev = c->read;
413 wev = c->write;
414
415 ngx_memzero(c, sizeof(ngx_connection_t));
416
417 c->read = rev;
418 c->write = wev;
419 c->fd = s;
420 c->log = log;
421
422 instance = rev->instance;
423
424 ngx_memzero(rev, sizeof(ngx_event_t));
425 ngx_memzero(wev, sizeof(ngx_event_t));
426
427 rev->instance = !instance;
428 wev->instance = !instance;
429
430 rev->index = NGX_INVALID_INDEX;
431 wev->index = NGX_INVALID_INDEX;
432
433 rev->data = c;
434 wev->data = c;
435
436 wev->write = 1;
437
410 return c; 438 return c;
411 } 439 }
412 440
413 441
414 void 442 void