nginx-0.3.2-RELEASE import
*) 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.
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index a7371bf..3f36d31 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -372,7 +372,9 @@
ngx_connection_t *
ngx_get_connection(ngx_socket_t s, ngx_log_t *log)
{
- ngx_connection_t *c;
+ ngx_uint_t instance;
+ ngx_event_t *rev, *wev;
+ ngx_connection_t *c;
/* disable warning: Win32 SOCKET is u_int while UNIX socket is int */
@@ -407,6 +409,32 @@
ngx_cycle->files[s] = c;
}
+ rev = c->read;
+ wev = c->write;
+
+ ngx_memzero(c, sizeof(ngx_connection_t));
+
+ c->read = rev;
+ c->write = wev;
+ c->fd = s;
+ c->log = log;
+
+ instance = rev->instance;
+
+ ngx_memzero(rev, sizeof(ngx_event_t));
+ ngx_memzero(wev, sizeof(ngx_event_t));
+
+ rev->instance = !instance;
+ wev->instance = !instance;
+
+ rev->index = NGX_INVALID_INDEX;
+ wev->index = NGX_INVALID_INDEX;
+
+ rev->data = c;
+ wev->data = c;
+
+ wev->write = 1;
+
return c;
}