comparison src/event/modules/ngx_select_module.c @ 324:f7cd062ee035 NGINX_0_6_6

nginx 0.6.6 *) Feature: the --sysconfdir=PATH option in configure. *) Feature: named locations. *) Feature: the $args variable can be set with the "set" directive. *) Feature: the $is_args variable. *) Bugfix: fair big weight upstream balancer. *) Bugfix: if a client has closed connection to mail proxy then nginx might not close connection to backend. *) Bugfix: if the same host without specified port was used as backend for HTTP and HTTPS, then nginx used only one port - 80 or 443. *) Bugfix: fix building on Solaris/amd64 by Sun Studio 11 and early versions; bug appeared in 0.6.4.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Jul 2007 00:00:00 +0400
parents c982febb7588
children b743d290eb3b
comparison
equal deleted inserted replaced
323:7e977a664d91 324:f7cd062ee035
10 10
11 11
12 12
13 static ngx_int_t ngx_select_init(ngx_cycle_t *cycle, ngx_msec_t timer); 13 static ngx_int_t ngx_select_init(ngx_cycle_t *cycle, ngx_msec_t timer);
14 static void ngx_select_done(ngx_cycle_t *cycle); 14 static void ngx_select_done(ngx_cycle_t *cycle);
15 static ngx_int_t ngx_select_add_event(ngx_event_t *ev, int event, u_int flags); 15 static ngx_int_t ngx_select_add_event(ngx_event_t *ev, ngx_int_t event,
16 static ngx_int_t ngx_select_del_event(ngx_event_t *ev, int event, u_int flags); 16 ngx_uint_t flags);
17 static ngx_int_t ngx_select_del_event(ngx_event_t *ev, ngx_int_t event,
18 ngx_uint_t flags);
17 static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, 19 static ngx_int_t ngx_select_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
18 ngx_uint_t flags); 20 ngx_uint_t flags);
19 static char *ngx_select_init_conf(ngx_cycle_t *cycle, void *conf); 21 static char *ngx_select_init_conf(ngx_cycle_t *cycle, void *conf);
20 22
21 23
23 static fd_set master_write_fd_set; 25 static fd_set master_write_fd_set;
24 static fd_set work_read_fd_set; 26 static fd_set work_read_fd_set;
25 static fd_set work_write_fd_set; 27 static fd_set work_write_fd_set;
26 28
27 #if (NGX_WIN32) 29 #if (NGX_WIN32)
28 static int max_read; 30 static ngx_uint_t max_read;
29 static int max_write; 31 static ngx_uint_t max_write;
30 #else 32 #else
31 static int max_fd; 33 static ngx_int_t max_fd;
32 #endif 34 #endif
33 35
34 static ngx_uint_t nevents; 36 static ngx_uint_t nevents;
35 37
36 static ngx_event_t **event_index; 38 static ngx_event_t **event_index;
127 event_index = NULL; 129 event_index = NULL;
128 } 130 }
129 131
130 132
131 static ngx_int_t 133 static ngx_int_t
132 ngx_select_add_event(ngx_event_t *ev, int event, u_int flags) 134 ngx_select_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
133 { 135 {
134 ngx_connection_t *c; 136 ngx_connection_t *c;
135 137
136 c = ev->data; 138 c = ev->data;
137 139
138 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, 140 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
139 "select add event fd:%d ev:%d", c->fd, event); 141 "select add event fd:%d ev:%i", c->fd, event);
140 142
141 if (ev->index != NGX_INVALID_INDEX) { 143 if (ev->index != NGX_INVALID_INDEX) {
142 ngx_log_error(NGX_LOG_ALERT, ev->log, 0, 144 ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
143 "select event fd:%d ev:%d is already set", c->fd, event); 145 "select event fd:%d ev:%i is already set", c->fd, event);
144 return NGX_OK; 146 return NGX_OK;
145 } 147 }
146 148
147 #if (NGX_WIN32) 149 #if (NGX_WIN32)
148 150
188 return NGX_OK; 190 return NGX_OK;
189 } 191 }
190 192
191 193
192 static ngx_int_t 194 static ngx_int_t
193 ngx_select_del_event(ngx_event_t *ev, int event, u_int flags) 195 ngx_select_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
194 { 196 {
195 ngx_connection_t *c; 197 ngx_connection_t *c;
196 198
197 c = ev->data; 199 c = ev->data;
198 200
201 if (ev->index == NGX_INVALID_INDEX) { 203 if (ev->index == NGX_INVALID_INDEX) {
202 return NGX_OK; 204 return NGX_OK;
203 } 205 }
204 206
205 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, 207 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
206 "select del event fd:%d ev:%d", c->fd, event); 208 "select del event fd:%d ev:%i", c->fd, event);
207 209
208 #if (NGX_WIN32) 210 #if (NGX_WIN32)
209 211
210 if (event == NGX_READ_EVENT) { 212 if (event == NGX_READ_EVENT) {
211 FD_CLR(c->fd, &master_read_fd_set); 213 FD_CLR(c->fd, &master_read_fd_set);
229 max_fd = -1; 231 max_fd = -1;
230 } 232 }
231 233
232 #endif 234 #endif
233 235
234 if (ev->index < (u_int) --nevents) { 236 if (ev->index < --nevents) {
235 event_index[ev->index] = event_index[nevents]; 237 event_index[ev->index] = event_index[nevents];
236 event_index[ev->index]->index = ev->index; 238 event_index[ev->index]->index = ev->index;
237 } 239 }
238 240
239 ev->index = NGX_INVALID_INDEX; 241 ev->index = NGX_INVALID_INDEX;