diff src/event/ngx_event.c @ 6:669801705ab1

nginx-0.0.1-2002-08-26-19:18:19 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 26 Aug 2002 15:18:19 +0000
parents c5f071d376e5
children b5481d6fbbd4
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -46,15 +46,15 @@ void ngx_pre_thread(ngx_array_t *ls, ngx
     int  i, fd;
     ngx_listen_t *s;
 
-    /* per group */
+    /* STUB */
     int max_connections = 512;
 
     ngx_init_events(max_connections, log);
 
+    ngx_connections = ngx_alloc(sizeof(ngx_connection_t)
+                                                       * max_connections, log);
     ngx_read_events = ngx_alloc(sizeof(ngx_event_t) * max_connections, log);
     ngx_write_events = ngx_alloc(sizeof(ngx_event_t) * max_connections, log);
-    ngx_connections = ngx_alloc(sizeof(ngx_connection_t)
-                                                     * max_connections, log);
 
     /* for each listening socket */
     s = (ngx_listen_t *) ls->elts;
@@ -62,16 +62,23 @@ void ngx_pre_thread(ngx_array_t *ls, ngx
 
         fd = s[i].fd;
 
+        ngx_memzero(&ngx_connections[fd], sizeof(ngx_connection_t));
         ngx_memzero(&ngx_read_events[fd], sizeof(ngx_event_t));
-        ngx_memzero(&ngx_write_events[fd], sizeof(ngx_event_t));
-        ngx_memzero(&ngx_connections[fd], sizeof(ngx_connection_t));
 
         ngx_connections[fd].fd = fd;
+        ngx_connections[fd].family = s[i].family;
+        ngx_connections[fd].socklen = s[i].socklen;
+        ngx_connections[fd].sockaddr = ngx_palloc(pool, s[i].socklen);
+        ngx_connections[fd].addr = s[i].addr;
+        ngx_connections[fd].addr_text = s[i].addr_text;
+        ngx_connections[fd].addr_textlen = s[i].addr_textlen;
+        ngx_connections[fd].post_accept_timeout = s[i].post_accept_timeout;
+
         ngx_connections[fd].server = s[i].server;
-        ngx_connections[fd].read = (void *) &ngx_read_events[fd].data;
         ngx_connections[fd].handler = s[i].handler;
-        ngx_read_events[fd].data = &ngx_connections[fd];
-        ngx_read_events[fd].log = ngx_connections[fd].log = s[i].log;
+        ngx_connections[fd].log = s[i].log;
+
+        ngx_read_events[fd].log = ngx_connections[fd].log;
         ngx_read_events[fd].data = &ngx_connections[fd];
         ngx_read_events[fd].event_handler = &ngx_event_accept;
         ngx_read_events[fd].listening = 1;
@@ -79,7 +86,7 @@ void ngx_pre_thread(ngx_array_t *ls, ngx
         ngx_read_events[fd].available = 0;
 
 #if (HAVE_DEFERRED_ACCEPT)
-        ngx_read_events[fd].accept_filter = s[i].accept_filter;
+        ngx_read_events[fd].deferred_accept = s[i].deferred_accept;
 #endif
         ngx_add_event(&ngx_read_events[fd], NGX_READ_EVENT, 0);
     }