Mercurial > hg > nginx-vendor-current
comparison src/event/modules/ngx_eventport_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 | fc223117327f |
children | a39aab45a53f |
comparison
equal
deleted
inserted
replaced
323:7e977a664d91 | 324:f7cd062ee035 |
---|---|
38 typedef struct port_notify { | 38 typedef struct port_notify { |
39 int portnfy_port; /* bind request(s) to port */ | 39 int portnfy_port; /* bind request(s) to port */ |
40 void *portnfy_user; /* user defined */ | 40 void *portnfy_user; /* user defined */ |
41 } port_notify_t; | 41 } port_notify_t; |
42 | 42 |
43 typedef struct itimerspec { /* definition per POSIX.4 */ | 43 typedef struct itimerspec { /* definition per POSIX.4 */ |
44 struct timespec it_interval; /* timer period */ | 44 struct timespec it_interval;/* timer period */ |
45 struct timespec it_value; /* timer expiration */ | 45 struct timespec it_value; /* timer expiration */ |
46 } itimerspec_t; | 46 } itimerspec_t; |
47 | 47 |
48 int port_create(void) | 48 int port_create(void) |
49 { | 49 { |
50 return -1; | 50 return -1; |
85 | 85 |
86 #endif | 86 #endif |
87 | 87 |
88 | 88 |
89 typedef struct { | 89 typedef struct { |
90 u_int events; | 90 ngx_uint_t events; |
91 } ngx_eventport_conf_t; | 91 } ngx_eventport_conf_t; |
92 | 92 |
93 | 93 |
94 static ngx_int_t ngx_eventport_init(ngx_cycle_t *cycle, ngx_msec_t timer); | 94 static ngx_int_t ngx_eventport_init(ngx_cycle_t *cycle, ngx_msec_t timer); |
95 static void ngx_eventport_done(ngx_cycle_t *cycle); | 95 static void ngx_eventport_done(ngx_cycle_t *cycle); |
96 static ngx_int_t ngx_eventport_add_event(ngx_event_t *ev, int event, | 96 static ngx_int_t ngx_eventport_add_event(ngx_event_t *ev, ngx_int_t event, |
97 u_int flags); | 97 ngx_uint_t flags); |
98 static ngx_int_t ngx_eventport_del_event(ngx_event_t *ev, int event, | 98 static ngx_int_t ngx_eventport_del_event(ngx_event_t *ev, ngx_int_t event, |
99 u_int flags); | 99 ngx_uint_t flags); |
100 static ngx_int_t ngx_eventport_process_events(ngx_cycle_t *cycle, | 100 static ngx_int_t ngx_eventport_process_events(ngx_cycle_t *cycle, |
101 ngx_msec_t timer, ngx_uint_t flags); | 101 ngx_msec_t timer, ngx_uint_t flags); |
102 | 102 |
103 static void *ngx_eventport_create_conf(ngx_cycle_t *cycle); | 103 static void *ngx_eventport_create_conf(ngx_cycle_t *cycle); |
104 static char *ngx_eventport_init_conf(ngx_cycle_t *cycle, void *conf); | 104 static char *ngx_eventport_init_conf(ngx_cycle_t *cycle, void *conf); |
105 | 105 |
106 static int ep = -1; | 106 static int ep = -1; |
107 static port_event_t *event_list; | 107 static port_event_t *event_list; |
108 static u_int nevents; | 108 static ngx_uint_t nevents; |
109 static timer_t event_timer = -1; | 109 static timer_t event_timer = -1; |
110 | 110 |
111 static ngx_str_t eventport_name = ngx_string("eventport"); | 111 static ngx_str_t eventport_name = ngx_string("eventport"); |
112 | 112 |
113 | 113 |
259 nevents = 0; | 259 nevents = 0; |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 static ngx_int_t | 263 static ngx_int_t |
264 ngx_eventport_add_event(ngx_event_t *ev, int event, u_int flags) | 264 ngx_eventport_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) |
265 { | 265 { |
266 int events, prev; | 266 ngx_int_t events, prev; |
267 ngx_event_t *e; | 267 ngx_event_t *e; |
268 ngx_connection_t *c; | 268 ngx_connection_t *c; |
269 | 269 |
270 c = ev->data; | 270 c = ev->data; |
271 | 271 |
289 if (e->oneshot) { | 289 if (e->oneshot) { |
290 events |= prev; | 290 events |= prev; |
291 } | 291 } |
292 | 292 |
293 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, | 293 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
294 "eventport add event: fd:%d ev:%04Xd", c->fd, events); | 294 "eventport add event: fd:%d ev:%04Xi", c->fd, events); |
295 | 295 |
296 if (port_associate(ep, PORT_SOURCE_FD, c->fd, events, | 296 if (port_associate(ep, PORT_SOURCE_FD, c->fd, events, |
297 (void *) ((uintptr_t) ev | ev->instance)) | 297 (void *) ((uintptr_t) ev | ev->instance)) |
298 == -1) | 298 == -1) |
299 { | 299 { |
308 return NGX_OK; | 308 return NGX_OK; |
309 } | 309 } |
310 | 310 |
311 | 311 |
312 static ngx_int_t | 312 static ngx_int_t |
313 ngx_eventport_del_event(ngx_event_t *ev, int event, u_int flags) | 313 ngx_eventport_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) |
314 { | 314 { |
315 ngx_event_t *e; | 315 ngx_event_t *e; |
316 ngx_connection_t *c; | 316 ngx_connection_t *c; |
317 | 317 |
318 /* | 318 /* |
338 event = POLLIN; | 338 event = POLLIN; |
339 } | 339 } |
340 | 340 |
341 if (e->oneshot) { | 341 if (e->oneshot) { |
342 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, | 342 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
343 "eventport change event: fd:%d ev:%04Xd", c->fd, event); | 343 "eventport change event: fd:%d ev:%04Xi", c->fd, event); |
344 | 344 |
345 if (port_associate(ep, PORT_SOURCE_FD, c->fd, event, | 345 if (port_associate(ep, PORT_SOURCE_FD, c->fd, event, |
346 (void *) ((uintptr_t) ev | ev->instance)) | 346 (void *) ((uintptr_t) ev | ev->instance)) |
347 == -1) | 347 == -1) |
348 { | 348 { |
394 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | 394 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
395 "eventport timer: %M", timer); | 395 "eventport timer: %M", timer); |
396 | 396 |
397 events = 1; | 397 events = 1; |
398 | 398 |
399 n = port_getn(ep, event_list, nevents, &events, tp); | 399 n = port_getn(ep, event_list, (u_int) nevents, &events, tp); |
400 | 400 |
401 err = ngx_errno; | 401 err = ngx_errno; |
402 | 402 |
403 if (flags & NGX_UPDATE_TIME) { | 403 if (flags & NGX_UPDATE_TIME) { |
404 ngx_time_update(0, 0); | 404 ngx_time_update(0, 0); |