annotate src/event/ngx_event.c @ 577:4d9ea73a627a release-0.3.10

nginx-0.3.10-RELEASE import *) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Nov 2005 13:30:52 +0000
parents 58475592100c
children 326634fb9d47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 435
diff changeset
1
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 435
diff changeset
2 /*
444
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 441
diff changeset
3 * Copyright (C) Igor Sysoev
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 435
diff changeset
4 */
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 435
diff changeset
5
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 #include <ngx_config.h>
17
8dd06e2844f5 nginx-0.0.1-2002-09-27-19:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents: 11
diff changeset
8 #include <ngx_core.h>
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #include <ngx_event.h>
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
10
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
11
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
12 #define DEFAULT_CONNECTIONS 512
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
13
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
15 extern ngx_module_t ngx_kqueue_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
16 extern ngx_module_t ngx_devpoll_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
17 extern ngx_module_t ngx_epoll_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
18 extern ngx_module_t ngx_rtsig_module;
97
70d2345a903f nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 96
diff changeset
19 extern ngx_module_t ngx_select_module;
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
20
63
36d2c25cc9bb nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 60
diff changeset
21
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
22 static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle);
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
23 static ngx_int_t ngx_event_process_init(ngx_cycle_t *cycle);
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
24 static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
25
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
26 static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd,
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
27 void *conf);
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
28 static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
29 static char *ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd,
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
30 void *conf);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
31
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
32 static void *ngx_event_create_conf(ngx_cycle_t *cycle);
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
33 static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
435
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
34 static char *ngx_accept_mutex_check(ngx_conf_t *cf, void *post, void *data);
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
35
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
36
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
37 static ngx_uint_t ngx_timer_resolution;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
38 sig_atomic_t ngx_event_timer_alarm;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
39
495
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
40 static ngx_uint_t ngx_event_max_module;
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
41
495
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
42 ngx_uint_t ngx_event_flags;
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
43 ngx_event_actions_t ngx_event_actions;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
44
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
46 ngx_atomic_t connection_counter = 1;
493
975f62e77f02 nginx-0.1.21-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 483
diff changeset
47 ngx_atomic_t *ngx_connection_counter = &connection_counter;
309
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
48
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
49
493
975f62e77f02 nginx-0.1.21-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 483
diff changeset
50 ngx_atomic_t *ngx_accept_mutex_ptr;
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
51 ngx_atomic_t *ngx_accept_mutex_last_owner;
493
975f62e77f02 nginx-0.1.21-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 483
diff changeset
52 ngx_atomic_t *ngx_accept_mutex;
495
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
53 ngx_uint_t ngx_accept_mutex_held;
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
54 ngx_msec_t ngx_accept_mutex_delay;
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
55 ngx_int_t ngx_accept_disabled;
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
56 ngx_file_t ngx_accept_mutex_lock_file;
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
57
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
59 #if (NGX_STAT_STUB)
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
60
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
61 ngx_atomic_t ngx_stat_accepted0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
62 ngx_atomic_t *ngx_stat_accepted = &ngx_stat_accepted0;
495
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
63 ngx_atomic_t ngx_stat_handled0;
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
64 ngx_atomic_t *ngx_stat_handled = &ngx_stat_handled0;
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
65 ngx_atomic_t ngx_stat_requests0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
66 ngx_atomic_t *ngx_stat_requests = &ngx_stat_requests0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
67 ngx_atomic_t ngx_stat_active0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
68 ngx_atomic_t *ngx_stat_active = &ngx_stat_active0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
69 ngx_atomic_t ngx_stat_reading0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
70 ngx_atomic_t *ngx_stat_reading = &ngx_stat_reading0;
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
71 ngx_atomic_t ngx_stat_writing0;
495
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
72 ngx_atomic_t *ngx_stat_writing = &ngx_stat_writing0;
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
73
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
74 #endif
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
75
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
76
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
77
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
78 static ngx_command_t ngx_events_commands[] = {
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
79
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
80 { ngx_string("events"),
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
81 NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
82 ngx_events_block,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
83 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
84 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
85 NULL },
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
86
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
87 ngx_null_command
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
88 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
89
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
90
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 309
diff changeset
91 static ngx_core_module_t ngx_events_module_ctx = {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 309
diff changeset
92 ngx_string("events"),
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 309
diff changeset
93 NULL,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 309
diff changeset
94 NULL
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
95 };
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 309
diff changeset
96
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
97
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
98 ngx_module_t ngx_events_module = {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
99 NGX_MODULE_V1,
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 309
diff changeset
100 &ngx_events_module_ctx, /* module context */
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
101 ngx_events_commands, /* module directives */
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
102 NGX_CORE_MODULE, /* module type */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
103 NULL, /* init master */
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
104 NULL, /* init module */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
105 NULL, /* init process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
106 NULL, /* init thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
107 NULL, /* exit thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
108 NULL, /* exit process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
109 NULL, /* exit master */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
110 NGX_MODULE_V1_PADDING
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
111 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
112
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
113
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
114 static ngx_str_t event_core_name = ngx_string("event_core");
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
115
435
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
116 static ngx_conf_post_t ngx_accept_mutex_post = { ngx_accept_mutex_check } ;
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
117
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
118
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
119 static ngx_command_t ngx_event_core_commands[] = {
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
120
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
121 { ngx_string("worker_connections"),
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
122 NGX_EVENT_CONF|NGX_CONF_TAKE1,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
123 ngx_event_connections,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
124 0,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
125 0,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
126 NULL },
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
127
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
128 { ngx_string("connections"),
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
129 NGX_EVENT_CONF|NGX_CONF_TAKE1,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
130 ngx_event_connections,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
131 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
132 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
133 NULL },
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
134
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
135 { ngx_string("use"),
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
136 NGX_EVENT_CONF|NGX_CONF_TAKE1,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
137 ngx_event_use,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
138 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
139 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
140 NULL },
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
141
248
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
142 { ngx_string("multi_accept"),
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
143 NGX_EVENT_CONF|NGX_CONF_TAKE1,
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
144 ngx_conf_set_flag_slot,
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
145 0,
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
146 offsetof(ngx_event_conf_t, multi_accept),
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
147 NULL },
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
148
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
149 { ngx_string("accept_mutex"),
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
150 NGX_EVENT_CONF|NGX_CONF_TAKE1,
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
151 ngx_conf_set_flag_slot,
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
152 0,
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
153 offsetof(ngx_event_conf_t, accept_mutex),
435
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
154 &ngx_accept_mutex_post },
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
155
306
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
156 { ngx_string("accept_mutex_delay"),
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
157 NGX_EVENT_CONF|NGX_CONF_TAKE1,
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
158 ngx_conf_set_msec_slot,
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
159 0,
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
160 offsetof(ngx_event_conf_t, accept_mutex_delay),
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
161 NULL },
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
162
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
163 { ngx_string("debug_connection"),
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
164 NGX_EVENT_CONF|NGX_CONF_TAKE1,
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
165 ngx_event_debug_connection,
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
166 0,
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
167 0,
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
168 NULL },
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
169
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
170 ngx_null_command
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
171 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
172
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
173
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
174 ngx_event_module_t ngx_event_core_module_ctx = {
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
175 &event_core_name,
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
176 ngx_event_create_conf, /* create configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
177 ngx_event_init_conf, /* init configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
178
380
5ce6561246a5 nginx-0.0.7-2004-07-07-10:15:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 377
diff changeset
179 { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
180 };
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
181
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
182
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
183 ngx_module_t ngx_event_core_module = {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
184 NGX_MODULE_V1,
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
185 &ngx_event_core_module_ctx, /* module context */
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
186 ngx_event_core_commands, /* module directives */
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
187 NGX_EVENT_MODULE, /* module type */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
188 NULL, /* init master */
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
189 ngx_event_module_init, /* init module */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
190 ngx_event_process_init, /* init process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
191 NULL, /* init thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
192 NULL, /* exit thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
193 NULL, /* exit process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
194 NULL, /* exit master */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
195 NGX_MODULE_V1_PADDING
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
196 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
197
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
198
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
199 void
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
200 ngx_process_events_and_timers(ngx_cycle_t *cycle)
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
201 {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
202 ngx_uint_t flags;
567
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
203 ngx_msec_t timer, delta;
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
204
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
205 if (ngx_timer_resolution) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
206 timer = NGX_TIMER_INFINITE;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
207 flags = 0;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
208
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
209 } else {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
210 timer = ngx_event_find_timer();
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
211 flags = NGX_UPDATE_TIME;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
212
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
213 #if (NGX_THREADS)
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
214
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
215 if (timer == NGX_TIMER_INFINITE || timer > 500) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
216 timer = 500;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
217 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
218
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
219 #endif
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
220 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
221
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
222 if (ngx_accept_mutex) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
223 if (ngx_accept_disabled > 0) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
224 ngx_accept_disabled--;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
225
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
226 } else {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
227 if (ngx_trylock_accept_mutex(cycle) == NGX_ERROR) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
228 return;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
229 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
230
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
231 if (ngx_accept_mutex_held) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
232 flags |= NGX_POST_EVENTS;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
233
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
234 } else {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
235 if (timer == NGX_TIMER_INFINITE
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
236 || timer > ngx_accept_mutex_delay)
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
237 {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
238 timer = ngx_accept_mutex_delay;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
239 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
240 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
241 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
242 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
243
567
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
244 delta = ngx_current_msec;
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
245
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
246 (void) ngx_process_events(cycle, timer, flags);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
247
567
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
248 delta = ngx_current_msec - delta;
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
249
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
250 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
251 "timer delta: %M", delta);
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
252
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
253 if (ngx_posted_accept_events) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
254 ngx_event_process_posted(cycle, &ngx_posted_accept_events);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
255 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
256
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
257 if (ngx_accept_mutex_held) {
567
1af2fcb3be8a nginx-0.3.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
258 *ngx_accept_mutex = 0;
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
259 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
260
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
261 if (delta) {
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
262 ngx_event_expire_timers();
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
263 }
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
264
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
265 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
266 "posted events %p", ngx_posted_events);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
267
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
268 if (ngx_posted_events) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
269 if (ngx_threaded) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
270 ngx_wakeup_worker_thread(cycle);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
271
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
272 } else {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
273 ngx_event_process_posted(cycle, &ngx_posted_events);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
274 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
275 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
276 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
277
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
278
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
279 ngx_int_t
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
280 ngx_handle_read_event(ngx_event_t *rev, u_int flags)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
281 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
282 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
283
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
284 /* kqueue, epoll */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
285
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
286 if (!rev->active && !rev->ready) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
287 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_CLEAR_EVENT)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
288 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
289 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
290 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
291 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
292 }
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
293
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
294 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
295
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
296 } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
297
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
298 /* select, poll, /dev/poll */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
299
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
300 if (!rev->active && !rev->ready) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
301 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
302 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
303 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
304 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
305 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
306
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
307 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
308 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
309
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
310 if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
311 if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
312 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
313 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
314 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
315 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
316
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
317 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
318 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
319
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
320 } else if (ngx_event_flags & NGX_USE_ONESHOT_EVENT) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
321
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
322 /* event ports */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
323
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
324 if (!rev->active) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
325 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_ONESHOT_EVENT)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
326 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
327 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
328 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
329 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
330 }
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
331
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
332 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
333 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
334
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
335 /* aio, iocp, rtsig */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
336
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
337 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
338 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
339
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
340
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
341 ngx_int_t
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
342 ngx_handle_write_event(ngx_event_t *wev, size_t lowat)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
343 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
344 ngx_connection_t *c;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
345
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
346 if (lowat) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
347 c = (ngx_connection_t *) wev->data;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
348
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
349 if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
350 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
351 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
352 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
353
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
354 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
355
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
356 /* kqueue, epoll */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
357
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
358 if (!wev->active && !wev->ready) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
359 if (ngx_add_event(wev, NGX_WRITE_EVENT,
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
360 NGX_CLEAR_EVENT | (lowat ? NGX_LOWAT_EVENT : 0))
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
361 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
362 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
363 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
364 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
365 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
366
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
367 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
368
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
369 } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
370
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
371 /* select, poll, /dev/poll */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
372
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
373 if (!wev->active && !wev->ready) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
374 if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
375 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
376 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
377 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
378 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
379
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
380 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
381 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
382
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
383 if (wev->active && wev->ready) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
384 if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
385 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
386 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
387 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
388 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
389
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
390 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
391 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
392
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
393 } else if (ngx_event_flags & NGX_USE_ONESHOT_EVENT) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
394
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
395 /* event ports */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
396
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
397 if (!wev->active) {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
398 if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_ONESHOT_EVENT)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
399 == NGX_ERROR)
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
400 {
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
401 return NGX_ERROR;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
402 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
403 }
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
404
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
405 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
406 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
407
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
408 /* aio, iocp, rtsig */
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
409
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
410 return NGX_OK;
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
411 }
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
412
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
413
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
414 static ngx_int_t
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
415 ngx_event_module_init(ngx_cycle_t *cycle)
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
416 {
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
417 void ***cf;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
418 ngx_event_conf_t *ecf;
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
419 ngx_core_conf_t *ccf;
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
420 #if !(NGX_WIN32)
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
421 char *shared;
473
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
422 size_t size;
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
423 ngx_int_t limit;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
424 struct rlimit rlmt;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
425 #endif
473
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
426
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
427 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module);
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
428
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
429 if (cf == NULL) {
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
430 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
431 "no \"events\" section in configuration");
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
432 return NGX_ERROR;
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
433 }
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
434
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
435 ecf = (*cf)[ngx_event_core_module.ctx_index];
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
436
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
437 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
473
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
438 "using the \"%s\" event method", ecf->name);
8e8f3af115b5 nginx-0.1.11-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
439
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
440 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
441
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
442 ngx_timer_resolution = ccf->timer_resolution;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
443
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
444 #if !(NGX_WIN32)
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
445
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
446 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
447 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
448 "getrlimit(RLIMIT_NOFILE) failed, ignored");
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
449
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
450 } else {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
451 if (ecf->connections > (ngx_uint_t) rlmt.rlim_cur
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
452 && (ccf->rlimit_nofile == NGX_CONF_UNSET
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
453 || ecf->connections > (ngx_uint_t) ccf->rlimit_nofile))
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
454 {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
455 limit = (ccf->rlimit_nofile == NGX_CONF_UNSET) ?
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
456 (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
457
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
458 ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
459 "%ui worker_connections are more than "
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
460 "open file resource limit: %i",
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
461 ecf->connections, limit);
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
462 }
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
463 }
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
464
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
465
325
7c3323909107 nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents: 323
diff changeset
466 if (ccf->master == 0 || ngx_accept_mutex_ptr) {
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
467 return NGX_OK;
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
468 }
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
469
309
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
470
483
621229427cba nginx-0.1.16-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 481
diff changeset
471 /* TODO: adjust cache line size, 128 is P4 cache line size */
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
472
309
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
473 size = 128 /* ngx_accept_mutex */
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
474 + 128 /* ngx_accept_mutex_last_owner */
309
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
475 + 128; /* ngx_connection_counter */
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
476
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
477 #if (NGX_STAT_STUB)
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
478
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
479 size += 128 /* ngx_stat_accepted */
495
fc9909c369b2 nginx-0.1.22-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
480 + 128 /* ngx_stat_handled */
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
481 + 128 /* ngx_stat_requests */
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
482 + 128 /* ngx_stat_active */
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
483 + 128 /* ngx_stat_reading */
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
484 + 128; /* ngx_stat_writing */
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
485
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
486 #endif
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
487
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
488 shared = ngx_create_shared_memory(size, cycle->log);
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
489 if (shared == NULL) {
358
0a03c921c81d nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
490 return NGX_ERROR;
0a03c921c81d nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
491 }
309
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
492
330
377a955421dc nginx-0.0.3-2004-04-29-20:34:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 325
diff changeset
493 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
494 ngx_accept_mutex_last_owner = (ngx_atomic_t *) (shared + 1 * 128);
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
495 ngx_connection_counter = (ngx_atomic_t *) (shared + 2 * 128);
309
2e899477243a nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
496
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
497 #if (NGX_STAT_STUB)
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
498
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
499 ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * 128);
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
500 ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * 128);
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
501 ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * 128);
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
502 ngx_stat_active = (ngx_atomic_t *) (shared + 6 * 128);
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
503 ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * 128);
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
504 ngx_stat_writing = (ngx_atomic_t *) (shared + 8 * 128);
426
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
505
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
506 #endif
3f88935a02e8 nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 380
diff changeset
507
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
508 *ngx_connection_counter = 1;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
509
325
7c3323909107 nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents: 323
diff changeset
510 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
511 "counter: %p, %d",
325
7c3323909107 nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents: 323
diff changeset
512 ngx_connection_counter, *ngx_connection_counter);
7c3323909107 nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents: 323
diff changeset
513
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
514 #endif /* !(NGX_WIN32) */
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
515
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
516 return NGX_OK;
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
517 }
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
518
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
519
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
520 #if !(NGX_WIN32)
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
521
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
522 void
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
523 ngx_timer_signal_handler(int signo)
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
524 {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
525 ngx_event_timer_alarm = 1;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
526
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
527 ngx_time_update(0, 0);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
528
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
529 #if 1
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
530 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0, "timer signal");
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
531 #endif
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
532 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
533
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
534 #endif
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
535
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
536
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
537 static ngx_int_t
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
538 ngx_event_process_init(ngx_cycle_t *cycle)
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
539 {
290
87e73f067470 nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 288
diff changeset
540 ngx_uint_t m, i;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
541 ngx_event_t *rev, *wev;
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
542 ngx_listening_t *ls;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
543 ngx_connection_t *c, *next, *old;
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
544 ngx_core_conf_t *ccf;
97
70d2345a903f nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 96
diff changeset
545 ngx_event_conf_t *ecf;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
546 ngx_event_module_t *module;
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
547 #if (NGX_WIN32)
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
548 ngx_iocp_conf_t *iocpcf;
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
549 #else
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
550 struct rlimit rlmt;
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
551 struct sigaction sa;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
552 struct itimerval itv;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
553 #endif
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
554
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
555 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
306
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
556 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
557
331
f168a88e93f7 nginx-0.0.3-2004-05-04-21:56:58 import
Igor Sysoev <igor@sysoev.ru>
parents: 330
diff changeset
558 if (ngx_accept_mutex_ptr && ccf->worker_processes > 1 && ecf->accept_mutex)
f168a88e93f7 nginx-0.0.3-2004-05-04-21:56:58 import
Igor Sysoev <igor@sysoev.ru>
parents: 330
diff changeset
559 {
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
560 ngx_accept_mutex = ngx_accept_mutex_ptr;
345
fade4edd61f8 nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 344
diff changeset
561 ngx_accept_mutex_held = 0;
306
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
562 ngx_accept_mutex_delay = ecf->accept_mutex_delay;
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
563 }
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
564
276
a2d1ccc96111 nginx-0.0.2-2004-03-03-00:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents: 272
diff changeset
565 #if (NGX_THREADS)
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
566 ngx_posted_events_mutex = ngx_mutex_init(cycle->log, 0);
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
567 if (ngx_posted_events_mutex == NULL) {
276
a2d1ccc96111 nginx-0.0.2-2004-03-03-00:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents: 272
diff changeset
568 return NGX_ERROR;
a2d1ccc96111 nginx-0.0.2-2004-03-03-00:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents: 272
diff changeset
569 }
a2d1ccc96111 nginx-0.0.2-2004-03-03-00:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents: 272
diff changeset
570 #endif
a2d1ccc96111 nginx-0.0.2-2004-03-03-00:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents: 272
diff changeset
571
270
7bb9562216ce nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents: 260
diff changeset
572 if (ngx_event_timer_init(cycle->log) == NGX_ERROR) {
7bb9562216ce nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents: 260
diff changeset
573 return NGX_ERROR;
7bb9562216ce nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents: 260
diff changeset
574 }
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
575
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
576 cycle->connection_n = ecf->connections;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
577
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
578 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
579 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
580 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
581 }
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
582
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
583 if (ngx_modules[m]->ctx_index == ecf->use) {
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
584 module = ngx_modules[m]->ctx;
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
585 if (module->actions.init(cycle, ngx_timer_resolution) == NGX_ERROR)
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
586 {
245
e6c005b66b3a nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents: 230
diff changeset
587 /* fatal */
e6c005b66b3a nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents: 230
diff changeset
588 exit(2);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
589 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
590 break;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
591 }
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 39
diff changeset
592 }
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
593
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
594 #if !(NGX_WIN32)
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
595
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
596 if (ngx_timer_resolution && !(ngx_event_flags & NGX_USE_TIMER_EVENT)) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
597
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
598 ngx_memzero(&sa, sizeof(struct sigaction));
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
599 sa.sa_handler = ngx_timer_signal_handler;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
600 sigemptyset(&sa.sa_mask);
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
601
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
602 if (sigaction(SIGALRM, &sa, NULL) == -1) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
603 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
604 "sigaction(SIGALRM) failed");
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
605 return NGX_ERROR;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
606 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
607
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
608 itv.it_interval.tv_sec = ngx_timer_resolution / 1000;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
609 itv.it_interval.tv_usec = (ngx_timer_resolution % 1000) * 1000;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
610 itv.it_value.tv_sec = ngx_timer_resolution / 1000;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
611 itv.it_value.tv_usec = (ngx_timer_resolution % 1000 ) * 1000;
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
612
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
613 if (setitimer(ITIMER_REAL, &itv, NULL) == -1) {
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
614 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
615 "setitimer() failed");
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
616 }
563
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
617 }
9c2f3ed7a247 nginx-0.3.3-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
618
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
619 if (ngx_event_flags & NGX_USE_FD_EVENT) {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
620
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
621 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
622 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
623 "getrlimit(RLIMIT_NOFILE) failed");
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
624 return NGX_ERROR;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
625 }
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
626
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
627 cycle->files_n = (ngx_uint_t) rlmt.rlim_cur;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
628
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
629 cycle->files = ngx_calloc(sizeof(ngx_connection_t *) * cycle->files_n,
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
630 cycle->log);
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
631 if (cycle->files == NULL) {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
632 return NGX_ERROR;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
633 }
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
634 }
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
635
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
636 #endif
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
637
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
638 cycle->connections = ngx_alloc(sizeof(ngx_connection_t) * ecf->connections,
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
639 cycle->log);
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
640 if (cycle->connections == NULL) {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
641 return NGX_ERROR;
112
da763a85be66 nginx-0.0.1-2003-07-04-10:03:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 109
diff changeset
642 }
da763a85be66 nginx-0.0.1-2003-07-04-10:03:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 109
diff changeset
643
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
644 c = cycle->connections;
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
645
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
646 cycle->read_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
647 cycle->log);
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
648 if (cycle->read_events == NULL) {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
649 return NGX_ERROR;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
650 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
651
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
652 rev = cycle->read_events;
375
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
653 for (i = 0; i < cycle->connection_n; i++) {
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
654 rev[i].closed = 1;
481
fd661d14a7fa nginx-0.1.15-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 473
diff changeset
655 rev[i].instance = 1;
377
41437e4fd9b4 nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents: 376
diff changeset
656 #if (NGX_THREADS)
41437e4fd9b4 nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents: 376
diff changeset
657 rev[i].lock = &c[i].lock;
380
5ce6561246a5 nginx-0.0.7-2004-07-07-10:15:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 377
diff changeset
658 rev[i].own_lock = &c[i].lock;
377
41437e4fd9b4 nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents: 376
diff changeset
659 #endif
375
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
660 }
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
661
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
662 cycle->write_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
481
fd661d14a7fa nginx-0.1.15-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 473
diff changeset
663 cycle->log);
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
664 if (cycle->write_events == NULL) {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
665 return NGX_ERROR;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
666 }
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
667
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
668 wev = cycle->write_events;
375
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
669 for (i = 0; i < cycle->connection_n; i++) {
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
670 wev[i].closed = 1;
377
41437e4fd9b4 nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents: 376
diff changeset
671 #if (NGX_THREADS)
41437e4fd9b4 nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents: 376
diff changeset
672 wev[i].lock = &c[i].lock;
380
5ce6561246a5 nginx-0.0.7-2004-07-07-10:15:04 import
Igor Sysoev <igor@sysoev.ru>
parents: 377
diff changeset
673 wev[i].own_lock = &c[i].lock;
377
41437e4fd9b4 nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents: 376
diff changeset
674 #endif
375
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
675 }
744ccb59062d nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 370
diff changeset
676
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
677 i = cycle->connection_n;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
678 next = NULL;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
679
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
680 do {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
681 i--;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
682
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
683 c[i].data = next;
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
684 c[i].read = &cycle->read_events[i];
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
685 c[i].write = &cycle->write_events[i];
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
686 c[i].fd = (ngx_socket_t) -1;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
687
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
688 next = &c[i];
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
689
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
690 #if (NGX_THREADS)
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
691 c[i].lock = 0;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
692 #endif
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
693 } while (i);
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
694
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
695 cycle->free_connections = next;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
696 cycle->free_connection_n = ecf->connections;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
697
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
698 /* for each listening socket */
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
699
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
700 ls = cycle->listening.elts;
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
701 for (i = 0; i < cycle->listening.nelts; i++) {
3
34a521b1a148 nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents: 0
diff changeset
702
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
703 c = ngx_get_connection(ls[i].fd, cycle->log);
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
704
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
705 if (c == NULL) {
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
706 return NGX_ERROR;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
707 }
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
708
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
709 c->log = &ls[i].log;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
710
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
711 c->listening = &ls[i];
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
712 ls[i].connection = c;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
713
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
714 c->ctx = ls[i].ctx;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
715 c->servers = ls[i].servers;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
716
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 543
diff changeset
717 rev = c->read;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
718
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
719 rev->log = c->log;
301
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
720 rev->accept = 1;
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
721
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 467
diff changeset
722 #if (NGX_HAVE_DEFERRED_ACCEPT)
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
723 rev->deferred_accept = ls[i].deferred_accept;
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
724 #endif
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
725
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
726 if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) {
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
727 if (ls[i].previous) {
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
728
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
729 /*
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
730 * delete the old accept events that were bound to
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
731 * the old cycle read events array
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
732 */
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
733
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
734 old = ls[i].previous->connection;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
735
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
736 if (ngx_del_event(old->read, NGX_READ_EVENT, NGX_CLOSE_EVENT)
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
737 == NGX_ERROR)
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 216
diff changeset
738 {
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
739 return NGX_ERROR;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
740 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
741
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
742 old->fd = (ngx_socket_t) -1;
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
743 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
744 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
745
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
746 #if (NGX_WIN32)
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
747
144
ef8c87afcfc5 nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents: 114
diff changeset
748 if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
749 rev->handler = ngx_event_acceptex;
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
750
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
751 if (ngx_add_event(rev, 0, NGX_IOCP_ACCEPT) == NGX_ERROR) {
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
752 return NGX_ERROR;
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
753 }
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
754
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
755 ls[i].log.handler = ngx_acceptex_log_error;
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
756
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
757 iocpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_iocp_module);
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
758 if (ngx_event_post_acceptex(&ls[i], iocpcf->post_acceptex)
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
759 == NGX_ERROR)
288
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 276
diff changeset
760 {
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
761 return NGX_ERROR;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
762 }
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
763
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
764 } else {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
765 rev->handler = ngx_event_accept;
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
766
301
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
767 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
768 return NGX_ERROR;
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
769 }
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
770 }
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
771
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
772 #else
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
773
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
774 rev->handler = ngx_event_accept;
260
5dacbb4daaf6 nginx-0.0.2-2004-02-17-20:53:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
775
345
fade4edd61f8 nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 344
diff changeset
776 if (ngx_accept_mutex) {
fade4edd61f8 nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 344
diff changeset
777 continue;
fade4edd61f8 nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 344
diff changeset
778 }
344
e366ba5db8f8 nginx-0.0.3-2004-06-01-10:04:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 331
diff changeset
779
346
55e496a8ece3 nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 345
diff changeset
780 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) {
345
fade4edd61f8 nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 344
diff changeset
781 if (ngx_add_conn(c) == NGX_ERROR) {
fade4edd61f8 nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 344
diff changeset
782 return NGX_ERROR;
301
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
783 }
344
e366ba5db8f8 nginx-0.0.3-2004-06-01-10:04:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 331
diff changeset
784
260
5dacbb4daaf6 nginx-0.0.2-2004-02-17-20:53:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
785 } else {
301
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
786 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
787 return NGX_ERROR;
744965ec6275 nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
788 }
260
5dacbb4daaf6 nginx-0.0.2-2004-02-17-20:53:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
789 }
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
790
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
791 #endif
543
511a89da35ad nginx-0.2.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 541
diff changeset
792
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
793 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
794
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
795 return NGX_OK;
3
34a521b1a148 nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents: 0
diff changeset
796 }
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
797
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
798
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
799 ngx_int_t
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
800 ngx_send_lowat(ngx_connection_t *c, size_t lowat)
452
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
801 {
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
802 int sndlowat;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
803
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
804 #if (NGX_HAVE_LOWAT_EVENT)
452
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
805
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
806 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
452
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
807 c->write->available = lowat;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
808 return NGX_OK;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
809 }
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
810
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
811 #endif
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 573
diff changeset
812
452
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
813 if (lowat == 0 || c->sndlowat) {
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
814 return NGX_OK;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
815 }
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
816
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
817 sndlowat = (int) lowat;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
818
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
819 if (setsockopt(c->fd, SOL_SOCKET, SO_SNDLOWAT,
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
820 (const void *) &sndlowat, sizeof(int)) == -1)
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
821 {
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
822 ngx_connection_error(c, ngx_socket_errno,
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
823 "setsockopt(SO_SNDLOWAT) failed");
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
824 return NGX_ERROR;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
825 }
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
826
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
827 c->sndlowat = 1;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
828
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
829 return NGX_OK;
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
830 }
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
831
23fb87bddda1 nginx-0.1.1-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
832
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
833 static char *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
834 ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
835 {
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
836 char *rv;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
837 void ***ctx;
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
838 ngx_uint_t i;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
839 ngx_conf_t pcf;
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
840 ngx_event_module_t *m;
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
841
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
842 /* count the number of the event modules and set up their indices */
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
843
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
844 ngx_event_max_module = 0;
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
845 for (i = 0; ngx_modules[i]; i++) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
846 if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
847 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
848 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
849
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
850 ngx_modules[i]->ctx_index = ngx_event_max_module++;
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
851 }
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
852
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
853 ctx = ngx_pcalloc(cf->pool, sizeof(void *));
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
854 if (ctx == NULL) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
855 return NGX_CONF_ERROR;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
856 }
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
857
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
858 *ctx = ngx_pcalloc(cf->pool, ngx_event_max_module * sizeof(void *));
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
859 if (*ctx == NULL) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
860 return NGX_CONF_ERROR;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
861 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
862
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
863 *(void **) conf = ctx;
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
864
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
865 for (i = 0; ngx_modules[i]; i++) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
866 if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
867 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
868 }
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
869
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
870 m = ngx_modules[i]->ctx;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
871
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
872 if (m->create_conf) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
873 (*ctx)[ngx_modules[i]->ctx_index] = m->create_conf(cf->cycle);
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
874 if ((*ctx)[ngx_modules[i]->ctx_index] == NULL) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
875 return NGX_CONF_ERROR;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
876 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
877 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
878 }
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
879
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
880 pcf = *cf;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
881 cf->ctx = ctx;
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
882 cf->module_type = NGX_EVENT_MODULE;
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
883 cf->cmd_type = NGX_EVENT_CONF;
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
884
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
885 rv = ngx_conf_parse(cf, NULL);
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
886
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
887 *cf = pcf;
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
888
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
889 if (rv != NGX_CONF_OK)
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
890 return rv;
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
891
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
892 for (i = 0; ngx_modules[i]; i++) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
893 if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
894 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
895 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
896
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
897 m = ngx_modules[i]->ctx;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
898
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
899 if (m->init_conf) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
900 rv = m->init_conf(cf->cycle, (*ctx)[ngx_modules[i]->ctx_index]);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
901 if (rv != NGX_CONF_OK) {
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
902 return rv;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
903 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
904 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
905 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
906
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
907 return NGX_CONF_OK;
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
908 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
909
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
910
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
911 static char *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
912 ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
913 {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
914 ngx_event_conf_t *ecf = conf;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
915
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
916 ngx_str_t *value;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
917
323
ba876b26b76d nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 311
diff changeset
918 if (ecf->connections != NGX_CONF_UNSET_UINT) {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
919 return "is duplicate" ;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
920 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
921
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
922 value = cf->args->elts;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
923 ecf->connections = ngx_atoi(value[1].data, value[1].len);
323
ba876b26b76d nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 311
diff changeset
924 if (ecf->connections == (ngx_uint_t) NGX_ERROR) {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
925 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
926 "invalid number \"%V\"", &value[1]);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
927
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
928 return NGX_CONF_ERROR;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
929 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
930
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
931 cf->cycle->connection_n = ecf->connections;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
932
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
933 return NGX_CONF_OK;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
934 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
935
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
936
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
937 static char *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
938 ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
939 {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
940 ngx_event_conf_t *ecf = conf;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
941
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
942 ngx_int_t m;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
943 ngx_str_t *value;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
944 ngx_event_conf_t *old_ecf;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
945 ngx_event_module_t *module;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
946
356
2e3cbc1bbe3c nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 355
diff changeset
947 if (ecf->use != NGX_CONF_UNSET_UINT) {
93
738fe44c70d5 nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 92
diff changeset
948 return "is duplicate" ;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
949 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
950
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
951 value = cf->args->elts;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
952
227
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 218
diff changeset
953 if (cf->cycle->old_cycle->conf_ctx) {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
954 old_ecf = ngx_event_get_conf(cf->cycle->old_cycle->conf_ctx,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
955 ngx_event_core_module);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
956 } else {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
957 old_ecf = NULL;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
958 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
959
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
960
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
961 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
962 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
963 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
964 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
965
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
966 module = ngx_modules[m]->ctx;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
967 if (module->name->len == value[1].len) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
968 if (ngx_strcmp(module->name->data, value[1].data) == 0) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
969 ecf->use = ngx_modules[m]->ctx_index;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
970 ecf->name = module->name->data;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
971
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
972 if (ngx_process == NGX_PROCESS_SINGLE
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
973 && old_ecf
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
974 && old_ecf->use != ecf->use)
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
975 {
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
976 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
977 "when the server runs without a master process "
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
978 "the \"%V\" event type must be the same as "
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
979 "in previous configuration - \"%s\" "
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
980 "and it can not be changed on the fly, "
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
981 "to change it you need to stop server "
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
982 "and start it again",
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
983 &value[1], old_ecf->name);
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
984
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
985 return NGX_CONF_ERROR;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
986 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
987
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
988 return NGX_CONF_OK;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
989 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
990 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
991 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
992
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
993 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
994 "invalid event type \"%V\"", &value[1]);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
995
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
996 return NGX_CONF_ERROR;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
997 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
998
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
999
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1000 static char *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1001 ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1002 {
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1003 #if (NGX_DEBUG)
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1004 ngx_event_conf_t *ecf = conf;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1005
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1006 in_addr_t *addr;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1007 ngx_str_t *value;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1008 struct hostent *h;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1009
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1010 value = cf->args->elts;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1011
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1012 /* AF_INET only */
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1013
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1014 addr = ngx_array_push(&ecf->debug_connection);
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1015 if (addr == NULL) {
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1016 return NGX_CONF_ERROR;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1017 }
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1018
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1019 *addr = inet_addr((char *) value[1].data);
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1020
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1021 if (*addr != INADDR_NONE) {
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1022 return NGX_OK;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1023 }
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1024
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1025 h = gethostbyname((char *) value[1].data);
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1026
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1027 if (h == NULL || h->h_addr_list[0] == NULL) {
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1028 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
461
a88a3e4e158f nginx-0.1.5-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
1029 "host \"%s\" not found", value[1].data);
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1030 return NGX_CONF_ERROR;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1031 }
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1032
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1033 *addr = *(in_addr_t *)(h->h_addr_list[0]);
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1034
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1035 #else
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1036
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1037 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1038 "\"debug_connection\" is ignored, you need to rebuild "
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1039 "nginx using --with-debug option to enable it");
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1040
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1041 #endif
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1042
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1043 return NGX_OK;
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1044 }
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1045
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1046
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1047 static void *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1048 ngx_event_create_conf(ngx_cycle_t *cycle)
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1049 {
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1050 ngx_event_conf_t *ecf;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1051
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1052 ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t));
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1053 if (ecf == NULL) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1054 return NGX_CONF_ERROR;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1055 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1056
323
ba876b26b76d nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 311
diff changeset
1057 ecf->connections = NGX_CONF_UNSET_UINT;
358
0a03c921c81d nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
1058 ecf->use = NGX_CONF_UNSET_UINT;
248
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 245
diff changeset
1059 ecf->multi_accept = NGX_CONF_UNSET;
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
1060 ecf->accept_mutex = NGX_CONF_UNSET;
306
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
1061 ecf->accept_mutex_delay = NGX_CONF_UNSET_MSEC;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
1062 ecf->name = (void *) NGX_CONF_UNSET;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1063
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1064 #if (NGX_DEBUG)
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1065
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1066 if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4,
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1067 sizeof(in_addr_t)) == NGX_ERROR)
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1068 {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1069 return NGX_CONF_ERROR;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1070 }
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1071
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1072 #endif
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
1073
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1074 return ecf;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1075 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1076
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1077
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1078 static char *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1079 ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1080 {
354
eaf1f651cf86 nginx-0.0.7-2004-06-15-11:55:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 352
diff changeset
1081 ngx_event_conf_t *ecf = conf;
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1082
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1083 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL)
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1084 int fd;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1085 #endif
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1086 #if (NGX_HAVE_RTSIG)
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1087 ngx_uint_t rtsig;
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1088 ngx_core_conf_t *ccf;
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1089 #endif
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1090 ngx_int_t i, connections;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1091 ngx_module_t *module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1092 ngx_event_module_t *event_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1093
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1094 connections = NGX_CONF_UNSET_UINT;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1095 module = NULL;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1096
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 467
diff changeset
1097 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL)
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1098
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1099 fd = epoll_create(100);
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1100
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1101 if (fd != -1) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1102 close(fd);
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1103 connections = DEFAULT_CONNECTIONS;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1104 module = &ngx_epoll_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1105
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1106 } else if (ngx_errno != NGX_ENOSYS) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1107 connections = DEFAULT_CONNECTIONS;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1108 module = &ngx_epoll_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1109 }
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1110
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1111 #endif
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1112
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 467
diff changeset
1113 #if (NGX_HAVE_RTSIG)
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1114
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1115 if (module == NULL) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1116 connections = DEFAULT_CONNECTIONS;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1117 module = &ngx_rtsig_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1118 rtsig = 1;
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1119
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1120 } else {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1121 rtsig = 0;
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1122 }
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1123
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1124 #endif
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1125
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 467
diff changeset
1126 #if (NGX_HAVE_DEVPOLL)
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1127
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1128 connections = DEFAULT_CONNECTIONS;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1129 module = &ngx_devpoll_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1130
360
239e37d44a34 nginx-0.0.7-2004-06-18-20:22:16 import
Igor Sysoev <igor@sysoev.ru>
parents: 358
diff changeset
1131 #endif
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1132
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 467
diff changeset
1133 #if (NGX_HAVE_KQUEUE)
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1134
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1135 connections = DEFAULT_CONNECTIONS;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1136 module = &ngx_kqueue_module;
253
b6793bc5034b nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 250
diff changeset
1137
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1138 #endif
351
af4c6b45a687 nginx-0.0.4-2004-06-10-22:36:57 import
Igor Sysoev <igor@sysoev.ru>
parents: 346
diff changeset
1139
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 467
diff changeset
1140 #if (NGX_HAVE_SELECT)
351
af4c6b45a687 nginx-0.0.4-2004-06-10-22:36:57 import
Igor Sysoev <igor@sysoev.ru>
parents: 346
diff changeset
1141
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1142 if (module == NULL) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1143
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1144 #if (NGX_WIN32 || FD_SETSIZE >= DEFAULT_CONNECTIONS)
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1145 connections = DEFAULT_CONNECTIONS;
355
0fb6c53fb135 nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents: 354
diff changeset
1146 #else
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1147 connections = FD_SETSIZE;
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1148 #endif
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1149 module = &ngx_select_module;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1150 }
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1151
355
0fb6c53fb135 nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents: 354
diff changeset
1152 #endif
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1153
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1154 if (module == NULL) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1155 for (i = 0; ngx_modules[i]; i++) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1156 if (ngx_modules[i]->type == NGX_EVENT_MODULE) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1157 event_module = ngx_modules[i]->ctx;
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1158
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1159 if (ngx_strcmp(event_module->name->data, event_core_name.data)
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1160 == 0)
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1161 {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1162 continue;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1163 }
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1164
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1165 module = ngx_modules[i];
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1166 break;
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1167 }
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1168 }
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1169 }
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1170
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1171 if (module == NULL) {
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1172 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "no events module found");
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1173 return NGX_CONF_ERROR;
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1174 }
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1175
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1176 ngx_conf_init_unsigned_value(ecf->connections, connections);
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1177 cycle->connection_n = ecf->connections;
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1178
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1179 ngx_conf_init_unsigned_value(ecf->use, module->ctx_index);
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
1180
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1181 event_module = module->ctx;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1182 ngx_conf_init_ptr_value(ecf->name, event_module->name->data);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
1183
250
1903c6821958 nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 249
diff changeset
1184 ngx_conf_init_value(ecf->multi_accept, 0);
303
00c5660d2707 nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 301
diff changeset
1185 ngx_conf_init_value(ecf->accept_mutex, 1);
306
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 305
diff changeset
1186 ngx_conf_init_msec_value(ecf->accept_mutex_delay, 500);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1187
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1188
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1189 #if (NGX_HAVE_RTSIG)
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1190
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1191 if (!rtsig) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1192 return NGX_CONF_OK;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1193 }
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1194
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 499
diff changeset
1195 if (ecf->accept_mutex) {
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1196 return NGX_CONF_OK;
354
eaf1f651cf86 nginx-0.0.7-2004-06-15-11:55:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 352
diff changeset
1197 }
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1198
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1199 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
354
eaf1f651cf86 nginx-0.0.7-2004-06-15-11:55:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 352
diff changeset
1200
467
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1201 if (ccf->worker_processes == 0) {
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1202 return NGX_CONF_OK;
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1203 }
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1204
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1205 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1206 "the \"rtsig\" method requires \"accept_mutex\" to be on");
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1207
bbd6b0b4a2b1 nginx-0.1.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 461
diff changeset
1208 return NGX_CONF_ERROR;
573
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1209
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1210 #else
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1211
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1212 return NGX_CONF_OK;
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1213
58475592100c nginx-0.3.8-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 567
diff changeset
1214 #endif
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
1215 }
435
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1216
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1217
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1218 static char *
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
1219 ngx_accept_mutex_check(ngx_conf_t *cf, void *post, void *data)
435
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1220 {
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1221 #if !(NGX_HAVE_ATOMIC_OPS)
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1222
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1223 ngx_flag_t *fp = data;
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1224
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1225 *fp = 0;
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1226
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1227 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
503
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
1228 "\"accept_mutex\" is not supported on this platform, "
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
1229 "ignored");
435
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1230
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1231 #endif
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1232
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1233 return NGX_CONF_OK;
5cdc4838d4e8 nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 426
diff changeset
1234 }