Mercurial > hg > nginx-quic
annotate src/event/ngx_event.c @ 8114:526dddf637bb
HTTP/2: run posted requests after reading body.
HTTP/2 code failed to run posted requests after calling the request body
handler, and this resulted in connection hang if a subrequest was created
in the body handler and no other actions were made.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 23 Sep 2020 19:52:31 +0300 |
parents | f1720934c45b |
children | 38c0898b6df7 9ca8fb98ef1c |
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 |
4412 | 4 * Copyright (C) Nginx, Inc. |
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
|
5 */ |
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
|
6 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #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
|
9 #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
|
10 #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
|
11 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
12 |
113
d7f606e25b99
nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
112
diff
changeset
|
13 #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
|
14 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
467 | 16 extern ngx_module_t ngx_kqueue_module; |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
17 extern ngx_module_t ngx_eventport_module; |
467 | 18 extern ngx_module_t ngx_devpoll_module; |
19 extern ngx_module_t ngx_epoll_module; | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
20 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
|
21 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
22 |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
23 static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf); |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
24 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
|
25 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
|
26 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
|
27 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
28 static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd, |
509 | 29 void *conf); |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
30 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
|
31 static char *ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, |
509 | 32 void *conf); |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
33 |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
34 static void *ngx_event_core_create_conf(ngx_cycle_t *cycle); |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
35 static char *ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf); |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
36 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
37 |
563 | 38 static ngx_uint_t ngx_timer_resolution; |
39 sig_atomic_t ngx_event_timer_alarm; | |
40 | |
495 | 41 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
|
42 |
495 | 43 ngx_uint_t ngx_event_flags; |
44 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
|
45 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
47 static ngx_atomic_t connection_counter = 1; |
493 | 48 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
|
49 |
2e899477243a
nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
50 |
493 | 51 ngx_atomic_t *ngx_accept_mutex_ptr; |
611 | 52 ngx_shmtx_t ngx_accept_mutex; |
53 ngx_uint_t ngx_use_accept_mutex; | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
54 ngx_uint_t ngx_accept_events; |
495 | 55 ngx_uint_t ngx_accept_mutex_held; |
56 ngx_msec_t ngx_accept_mutex_delay; | |
57 ngx_int_t ngx_accept_disabled; | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
58 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
59 |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
60 #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
|
61 |
6922
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
62 static ngx_atomic_t ngx_stat_accepted0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
63 ngx_atomic_t *ngx_stat_accepted = &ngx_stat_accepted0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
64 static ngx_atomic_t ngx_stat_handled0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
65 ngx_atomic_t *ngx_stat_handled = &ngx_stat_handled0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
66 static ngx_atomic_t ngx_stat_requests0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
67 ngx_atomic_t *ngx_stat_requests = &ngx_stat_requests0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
68 static ngx_atomic_t ngx_stat_active0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
69 ngx_atomic_t *ngx_stat_active = &ngx_stat_active0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
70 static ngx_atomic_t ngx_stat_reading0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
71 ngx_atomic_t *ngx_stat_reading = &ngx_stat_reading0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
72 static ngx_atomic_t ngx_stat_writing0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
73 ngx_atomic_t *ngx_stat_writing = &ngx_stat_writing0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
74 static ngx_atomic_t ngx_stat_waiting0; |
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
75 ngx_atomic_t *ngx_stat_waiting = &ngx_stat_waiting0; |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
76 |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
77 #endif |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
78 |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
79 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
80 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
81 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
|
82 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
83 { ngx_string("events"), |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
84 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
|
85 ngx_events_block, |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
86 0, |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
87 0, |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
88 NULL }, |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
89 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
90 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
|
91 }; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
92 |
577 | 93 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
309
diff
changeset
|
94 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
|
95 ngx_string("events"), |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
309
diff
changeset
|
96 NULL, |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
97 ngx_event_init_conf |
577 | 98 }; |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
309
diff
changeset
|
99 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
100 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
101 ngx_module_t ngx_events_module = { |
509 | 102 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
|
103 &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
|
104 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
|
105 NGX_CORE_MODULE, /* module type */ |
541 | 106 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
|
107 NULL, /* init module */ |
541 | 108 NULL, /* init process */ |
109 NULL, /* init thread */ | |
110 NULL, /* exit thread */ | |
111 NULL, /* exit process */ | |
112 NULL, /* exit master */ | |
113 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
|
114 }; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
115 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
116 |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
105
diff
changeset
|
117 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
|
118 |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
119 |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
105
diff
changeset
|
120 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
|
121 |
543 | 122 { ngx_string("worker_connections"), |
123 NGX_EVENT_CONF|NGX_CONF_TAKE1, | |
124 ngx_event_connections, | |
125 0, | |
126 0, | |
127 NULL }, | |
128 | |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
129 { ngx_string("use"), |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
130 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
|
131 ngx_event_use, |
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 0, |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
134 NULL }, |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
135 |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
136 { ngx_string("multi_accept"), |
667 | 137 NGX_EVENT_CONF|NGX_CONF_FLAG, |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
138 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
|
139 0, |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
140 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
|
141 NULL }, |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
142 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
143 { ngx_string("accept_mutex"), |
667 | 144 NGX_EVENT_CONF|NGX_CONF_FLAG, |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
145 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
|
146 0, |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
147 offsetof(ngx_event_conf_t, accept_mutex), |
611 | 148 NULL }, |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
149 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
150 { 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
|
151 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
|
152 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
|
153 0, |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
154 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
|
155 NULL }, |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
156 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
157 { 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
|
158 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
|
159 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
|
160 0, |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
161 0, |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
162 NULL }, |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
163 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
164 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
|
165 }; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
166 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
167 |
6922
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6635
diff
changeset
|
168 static ngx_event_module_t ngx_event_core_module_ctx = { |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
105
diff
changeset
|
169 &event_core_name, |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
170 ngx_event_core_create_conf, /* create configuration */ |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
171 ngx_event_core_init_conf, /* init configuration */ |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
172 |
6030
4652f8f26b12
Removed unix ngx_threaded and related ngx_process_changes.
Ruslan Ermilov <ru@nginx.com>
parents:
6018
diff
changeset
|
173 { 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
|
174 }; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
175 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
176 |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
105
diff
changeset
|
177 ngx_module_t ngx_event_core_module = { |
509 | 178 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
|
179 &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
|
180 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
|
181 NGX_EVENT_MODULE, /* module type */ |
541 | 182 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
|
183 ngx_event_module_init, /* init module */ |
541 | 184 ngx_event_process_init, /* init process */ |
185 NULL, /* init thread */ | |
186 NULL, /* exit thread */ | |
187 NULL, /* exit process */ | |
188 NULL, /* exit master */ | |
189 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
|
190 }; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
191 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
192 |
563 | 193 void |
194 ngx_process_events_and_timers(ngx_cycle_t *cycle) | |
195 { | |
196 ngx_uint_t flags; | |
567 | 197 ngx_msec_t timer, delta; |
563 | 198 |
199 if (ngx_timer_resolution) { | |
200 timer = NGX_TIMER_INFINITE; | |
201 flags = 0; | |
202 | |
203 } else { | |
204 timer = ngx_event_find_timer(); | |
205 flags = NGX_UPDATE_TIME; | |
206 | |
6113
36d99c042652
Replaced the remaining NGX_OLD_THREADS check with NGX_WIN32.
Ruslan Ermilov <ru@nginx.com>
parents:
6031
diff
changeset
|
207 #if (NGX_WIN32) |
36d99c042652
Replaced the remaining NGX_OLD_THREADS check with NGX_WIN32.
Ruslan Ermilov <ru@nginx.com>
parents:
6031
diff
changeset
|
208 |
36d99c042652
Replaced the remaining NGX_OLD_THREADS check with NGX_WIN32.
Ruslan Ermilov <ru@nginx.com>
parents:
6031
diff
changeset
|
209 /* handle signals from master in case of network inactivity */ |
563 | 210 |
211 if (timer == NGX_TIMER_INFINITE || timer > 500) { | |
212 timer = 500; | |
213 } | |
214 | |
215 #endif | |
216 } | |
217 | |
611 | 218 if (ngx_use_accept_mutex) { |
563 | 219 if (ngx_accept_disabled > 0) { |
220 ngx_accept_disabled--; | |
221 | |
222 } else { | |
223 if (ngx_trylock_accept_mutex(cycle) == NGX_ERROR) { | |
224 return; | |
225 } | |
226 | |
227 if (ngx_accept_mutex_held) { | |
228 flags |= NGX_POST_EVENTS; | |
229 | |
230 } else { | |
231 if (timer == NGX_TIMER_INFINITE | |
232 || timer > ngx_accept_mutex_delay) | |
233 { | |
234 timer = ngx_accept_mutex_delay; | |
235 } | |
236 } | |
237 } | |
238 } | |
239 | |
7584
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7316
diff
changeset
|
240 if (!ngx_queue_empty(&ngx_posted_next_events)) { |
7617
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
241 ngx_event_move_posted_next(cycle); |
7584
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7316
diff
changeset
|
242 timer = 0; |
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7316
diff
changeset
|
243 } |
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7316
diff
changeset
|
244 |
567 | 245 delta = ngx_current_msec; |
246 | |
563 | 247 (void) ngx_process_events(cycle, timer, flags); |
248 | |
567 | 249 delta = ngx_current_msec - delta; |
250 | |
251 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | |
252 "timer delta: %M", delta); | |
253 | |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
254 ngx_event_process_posted(cycle, &ngx_posted_accept_events); |
563 | 255 |
256 if (ngx_accept_mutex_held) { | |
611 | 257 ngx_shmtx_unlock(&ngx_accept_mutex); |
563 | 258 } |
259 | |
573 | 260 if (delta) { |
261 ngx_event_expire_timers(); | |
262 } | |
263 | |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
264 ngx_event_process_posted(cycle, &ngx_posted_events); |
563 | 265 } |
266 | |
267 | |
509 | 268 ngx_int_t |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
1092
diff
changeset
|
269 ngx_handle_read_event(ngx_event_t *rev, ngx_uint_t flags) |
509 | 270 { |
271 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) { | |
577 | 272 |
509 | 273 /* kqueue, epoll */ |
274 | |
275 if (!rev->active && !rev->ready) { | |
276 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_CLEAR_EVENT) | |
277 == NGX_ERROR) | |
278 { | |
279 return NGX_ERROR; | |
280 } | |
281 } | |
577 | 282 |
509 | 283 return NGX_OK; |
284 | |
285 } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) { | |
286 | |
287 /* select, poll, /dev/poll */ | |
288 | |
289 if (!rev->active && !rev->ready) { | |
290 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT) | |
291 == NGX_ERROR) | |
292 { | |
293 return NGX_ERROR; | |
294 } | |
295 | |
296 return NGX_OK; | |
297 } | |
298 | |
299 if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) { | |
300 if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags) | |
301 == NGX_ERROR) | |
302 { | |
303 return NGX_ERROR; | |
304 } | |
305 | |
306 return NGX_OK; | |
307 } | |
308 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
309 } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) { |
509 | 310 |
311 /* event ports */ | |
312 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
313 if (!rev->active && !rev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
314 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
509 | 315 return NGX_ERROR; |
316 } | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
317 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
318 return NGX_OK; |
509 | 319 } |
577 | 320 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
321 if (rev->oneshot && !rev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
322 if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
323 return NGX_ERROR; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
324 } |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
325 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
326 return NGX_OK; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
327 } |
509 | 328 } |
329 | |
6126
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
330 /* iocp */ |
509 | 331 |
332 return NGX_OK; | |
333 } | |
334 | |
335 | |
336 ngx_int_t | |
337 ngx_handle_write_event(ngx_event_t *wev, size_t lowat) | |
338 { | |
339 ngx_connection_t *c; | |
340 | |
341 if (lowat) { | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
342 c = wev->data; |
509 | 343 |
344 if (ngx_send_lowat(c, lowat) == NGX_ERROR) { | |
345 return NGX_ERROR; | |
346 } | |
347 } | |
348 | |
349 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) { | |
350 | |
351 /* kqueue, epoll */ | |
352 | |
353 if (!wev->active && !wev->ready) { | |
354 if (ngx_add_event(wev, NGX_WRITE_EVENT, | |
355 NGX_CLEAR_EVENT | (lowat ? NGX_LOWAT_EVENT : 0)) | |
356 == NGX_ERROR) | |
357 { | |
358 return NGX_ERROR; | |
359 } | |
360 } | |
361 | |
362 return NGX_OK; | |
363 | |
364 } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) { | |
365 | |
366 /* select, poll, /dev/poll */ | |
367 | |
368 if (!wev->active && !wev->ready) { | |
369 if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT) | |
370 == NGX_ERROR) | |
371 { | |
372 return NGX_ERROR; | |
373 } | |
374 | |
375 return NGX_OK; | |
376 } | |
377 | |
378 if (wev->active && wev->ready) { | |
379 if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT) | |
380 == NGX_ERROR) | |
381 { | |
382 return NGX_ERROR; | |
383 } | |
384 | |
385 return NGX_OK; | |
386 } | |
387 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
388 } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) { |
509 | 389 |
390 /* event ports */ | |
391 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
392 if (!wev->active && !wev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
393 if (ngx_add_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) { |
509 | 394 return NGX_ERROR; |
395 } | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
396 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
397 return NGX_OK; |
509 | 398 } |
577 | 399 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
400 if (wev->oneshot && wev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
401 if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
402 return NGX_ERROR; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
403 } |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
404 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
405 return NGX_OK; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
406 } |
509 | 407 } |
408 | |
6126
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
409 /* iocp */ |
509 | 410 |
411 return NGX_OK; | |
412 } | |
413 | |
414 | |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
415 static char * |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
416 ngx_event_init_conf(ngx_cycle_t *cycle, void *conf) |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
417 { |
7315
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
418 #if (NGX_HAVE_REUSEPORT) |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
419 ngx_uint_t i; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
420 ngx_listening_t *ls; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
421 #endif |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
422 |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
423 if (ngx_get_conf(cycle->conf_ctx, ngx_events_module) == NULL) { |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
424 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
425 "no \"events\" section in configuration"); |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
426 return NGX_CONF_ERROR; |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
427 } |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
428 |
7316
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
429 if (cycle->connection_n < cycle->listening.nelts + 1) { |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
430 |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
431 /* |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
432 * there should be at least one connection for each listening |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
433 * socket, plus an additional connection for channel |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
434 */ |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
435 |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
436 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
437 "%ui worker_connections are not enough " |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
438 "for %ui listening sockets", |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
439 cycle->connection_n, cycle->listening.nelts); |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
440 |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
441 return NGX_CONF_ERROR; |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
442 } |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
443 |
7315
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
444 #if (NGX_HAVE_REUSEPORT) |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
445 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
446 ls = cycle->listening.elts; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
447 for (i = 0; i < cycle->listening.nelts; i++) { |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
448 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
449 if (!ls[i].reuseport || ls[i].worker != 0) { |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
450 continue; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
451 } |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
452 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
453 if (ngx_clone_listening(cycle, &ls[i]) != NGX_OK) { |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
454 return NGX_CONF_ERROR; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
455 } |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
456 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
457 /* cloning may change cycle->listening.elts */ |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
458 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
459 ls = cycle->listening.elts; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
460 } |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
461 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
462 #endif |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
463 |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
464 return NGX_CONF_OK; |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
465 } |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
466 |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
467 |
509 | 468 static ngx_int_t |
469 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
|
470 { |
543 | 471 void ***cf; |
605 | 472 u_char *shared; |
611 | 473 size_t size, cl; |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
474 ngx_shm_t shm; |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
475 ngx_time_t *tp; |
563 | 476 ngx_core_conf_t *ccf; |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
477 ngx_event_conf_t *ecf; |
473 | 478 |
479 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module); | |
480 ecf = (*cf)[ngx_event_core_module.ctx_index]; | |
481 | |
2725 | 482 if (!ngx_test_config && ngx_process <= NGX_PROCESS_MASTER) { |
641 | 483 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, |
484 "using the \"%s\" event method", ecf->name); | |
485 } | |
473 | 486 |
563 | 487 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
|
488 |
563 | 489 ngx_timer_resolution = ccf->timer_resolution; |
490 | |
491 #if !(NGX_WIN32) | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
492 { |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
493 ngx_int_t limit; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
494 struct rlimit rlmt; |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
495 |
543 | 496 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) { |
497 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
498 "getrlimit(RLIMIT_NOFILE) failed, ignored"); | |
499 | |
500 } else { | |
501 if (ecf->connections > (ngx_uint_t) rlmt.rlim_cur | |
502 && (ccf->rlimit_nofile == NGX_CONF_UNSET | |
503 || ecf->connections > (ngx_uint_t) ccf->rlimit_nofile)) | |
504 { | |
505 limit = (ccf->rlimit_nofile == NGX_CONF_UNSET) ? | |
506 (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile; | |
507 | |
508 ngx_log_error(NGX_LOG_WARN, cycle->log, 0, | |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
509 "%ui worker_connections exceed " |
543 | 510 "open file resource limit: %i", |
511 ecf->connections, limit); | |
512 } | |
513 } | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
514 } |
605 | 515 #endif /* !(NGX_WIN32) */ |
516 | |
543 | 517 |
611 | 518 if (ccf->master == 0) { |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
519 return NGX_OK; |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
520 } |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
521 |
611 | 522 if (ngx_accept_mutex_ptr) { |
523 return NGX_OK; | |
524 } | |
525 | |
526 | |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
527 /* cl should be equal to or greater than cache line size */ |
611 | 528 |
529 cl = 128; | |
530 | |
531 size = cl /* ngx_accept_mutex */ | |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
532 + cl /* ngx_connection_counter */ |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
533 + cl; /* ngx_temp_number */ |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
534 |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
535 #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
|
536 |
611 | 537 size += cl /* ngx_stat_accepted */ |
538 + cl /* ngx_stat_handled */ | |
539 + cl /* ngx_stat_requests */ | |
540 + cl /* ngx_stat_active */ | |
541 + cl /* ngx_stat_reading */ | |
5115
a29c574d61fa
Status: introduced the "ngx_stat_waiting" counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5002
diff
changeset
|
542 + cl /* ngx_stat_writing */ |
a29c574d61fa
Status: introduced the "ngx_stat_waiting" counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5002
diff
changeset
|
543 + cl; /* ngx_stat_waiting */ |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
544 |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
545 #endif |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
546 |
605 | 547 shm.size = size; |
6947
a8d7c9139831
Core: set nginx_shared_zone name via ngx_str_set().
Ruslan Ermilov <ru@nginx.com>
parents:
6922
diff
changeset
|
548 ngx_str_set(&shm.name, "nginx_shared_zone"); |
605 | 549 shm.log = cycle->log; |
550 | |
551 if (ngx_shm_alloc(&shm) != NGX_OK) { | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
552 return NGX_ERROR; |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
553 } |
309
2e899477243a
nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
554 |
605 | 555 shared = shm.addr; |
556 | |
330
377a955421dc
nginx-0.0.3-2004-04-29-20:34:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
325
diff
changeset
|
557 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared; |
3909
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
3473
diff
changeset
|
558 ngx_accept_mutex.spin = (ngx_uint_t) -1; |
611 | 559 |
4309
3f6040cd731e
Added shmtx interface to forcibly unlock mutexes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
560 if (ngx_shmtx_create(&ngx_accept_mutex, (ngx_shmtx_sh_t *) shared, |
3f6040cd731e
Added shmtx interface to forcibly unlock mutexes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
561 cycle->lock_file.data) |
611 | 562 != NGX_OK) |
563 { | |
564 return NGX_ERROR; | |
565 } | |
566 | |
567 ngx_connection_counter = (ngx_atomic_t *) (shared + 1 * cl); | |
309
2e899477243a
nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
568 |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2537
diff
changeset
|
569 (void) ngx_atomic_cmp_set(ngx_connection_counter, 0, 1); |
563 | 570 |
325
7c3323909107
nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
571 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
6480 | 572 "counter: %p, %uA", |
325
7c3323909107
nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
573 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
|
574 |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
575 ngx_temp_number = (ngx_atomic_t *) (shared + 2 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
576 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
577 tp = ngx_timeofday(); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
578 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
579 ngx_random_number = (tp->msec << 16) + ngx_pid; |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
580 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
581 #if (NGX_STAT_STUB) |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
582 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
583 ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
584 ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
585 ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
586 ngx_stat_active = (ngx_atomic_t *) (shared + 6 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
587 ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
588 ngx_stat_writing = (ngx_atomic_t *) (shared + 8 * cl); |
5115
a29c574d61fa
Status: introduced the "ngx_stat_waiting" counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5002
diff
changeset
|
589 ngx_stat_waiting = (ngx_atomic_t *) (shared + 9 * cl); |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
590 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
591 #endif |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
592 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
593 return NGX_OK; |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
594 } |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
595 |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
596 |
563 | 597 #if !(NGX_WIN32) |
598 | |
4759
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4613
diff
changeset
|
599 static void |
563 | 600 ngx_timer_signal_handler(int signo) |
601 { | |
602 ngx_event_timer_alarm = 1; | |
603 | |
604 #if 1 | |
605 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0, "timer signal"); | |
606 #endif | |
607 } | |
608 | |
609 #endif | |
610 | |
611 | |
509 | 612 static ngx_int_t |
613 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
|
614 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
615 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
|
616 ngx_event_t *rev, *wev; |
543 | 617 ngx_listening_t *ls; |
618 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
|
619 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
|
620 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
|
621 ngx_event_module_t *module; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
622 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
623 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
|
624 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
|
625 |
865 | 626 if (ccf->master && ccf->worker_processes > 1 && ecf->accept_mutex) { |
611 | 627 ngx_use_accept_mutex = 1; |
345
fade4edd61f8
nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
628 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
|
629 ngx_accept_mutex_delay = ecf->accept_mutex_delay; |
611 | 630 |
631 } else { | |
632 ngx_use_accept_mutex = 0; | |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
633 } |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
634 |
5235
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
635 #if (NGX_WIN32) |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
636 |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
637 /* |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
638 * disable accept mutex on win32 as it may cause deadlock if |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
639 * grabbed by a process which can't accept connections |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
640 */ |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
641 |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
642 ngx_use_accept_mutex = 0; |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
643 |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
644 #endif |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
645 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
646 ngx_queue_init(&ngx_posted_accept_events); |
7584
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7316
diff
changeset
|
647 ngx_queue_init(&ngx_posted_next_events); |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
648 ngx_queue_init(&ngx_posted_events); |
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
649 |
270
7bb9562216ce
nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
260
diff
changeset
|
650 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
|
651 return NGX_ERROR; |
7bb9562216ce
nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
260
diff
changeset
|
652 } |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
653 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
654 for (m = 0; cycle->modules[m]; m++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
655 if (cycle->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
|
656 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
657 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
658 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
659 if (cycle->modules[m]->ctx_index != ecf->use) { |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
660 continue; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
661 } |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
662 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
663 module = cycle->modules[m]->ctx; |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
664 |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
665 if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) { |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
666 /* fatal */ |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
667 exit(2); |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
668 } |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
669 |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
670 break; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
671 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
672 |
543 | 673 #if !(NGX_WIN32) |
674 | |
563 | 675 if (ngx_timer_resolution && !(ngx_event_flags & NGX_USE_TIMER_EVENT)) { |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
676 struct sigaction sa; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
677 struct itimerval itv; |
563 | 678 |
679 ngx_memzero(&sa, sizeof(struct sigaction)); | |
680 sa.sa_handler = ngx_timer_signal_handler; | |
681 sigemptyset(&sa.sa_mask); | |
682 | |
683 if (sigaction(SIGALRM, &sa, NULL) == -1) { | |
684 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
685 "sigaction(SIGALRM) failed"); | |
686 return NGX_ERROR; | |
687 } | |
688 | |
689 itv.it_interval.tv_sec = ngx_timer_resolution / 1000; | |
690 itv.it_interval.tv_usec = (ngx_timer_resolution % 1000) * 1000; | |
691 itv.it_value.tv_sec = ngx_timer_resolution / 1000; | |
692 itv.it_value.tv_usec = (ngx_timer_resolution % 1000 ) * 1000; | |
693 | |
694 if (setitimer(ITIMER_REAL, &itv, NULL) == -1) { | |
695 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
696 "setitimer() failed"); | |
577 | 697 } |
563 | 698 } |
699 | |
543 | 700 if (ngx_event_flags & NGX_USE_FD_EVENT) { |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
701 struct rlimit rlmt; |
543 | 702 |
703 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) { | |
704 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
705 "getrlimit(RLIMIT_NOFILE) failed"); | |
706 return NGX_ERROR; | |
707 } | |
708 | |
709 cycle->files_n = (ngx_uint_t) rlmt.rlim_cur; | |
710 | |
711 cycle->files = ngx_calloc(sizeof(ngx_connection_t *) * cycle->files_n, | |
712 cycle->log); | |
713 if (cycle->files == NULL) { | |
714 return NGX_ERROR; | |
715 } | |
716 } | |
717 | |
6266
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
718 #else |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
719 |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
720 if (ngx_timer_resolution && !(ngx_event_flags & NGX_USE_TIMER_EVENT)) { |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
721 ngx_log_error(NGX_LOG_WARN, cycle->log, 0, |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
722 "the \"timer_resolution\" directive is not supported " |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
723 "with the configured event method, ignored"); |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
724 ngx_timer_resolution = 0; |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
725 } |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
726 |
543 | 727 #endif |
728 | |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
729 cycle->connections = |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
730 ngx_alloc(sizeof(ngx_connection_t) * cycle->connection_n, cycle->log); |
561 | 731 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
|
732 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
|
733 } |
da763a85be66
nginx-0.0.1-2003-07-04-10:03:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
109
diff
changeset
|
734 |
561 | 735 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
|
736 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
737 cycle->read_events = ngx_alloc(sizeof(ngx_event_t) * cycle->connection_n, |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
738 cycle->log); |
561 | 739 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
|
740 return NGX_ERROR; |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
741 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
742 |
561 | 743 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
|
744 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
|
745 rev[i].closed = 1; |
481 | 746 rev[i].instance = 1; |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
747 } |
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
748 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
749 cycle->write_events = ngx_alloc(sizeof(ngx_event_t) * cycle->connection_n, |
481 | 750 cycle->log); |
561 | 751 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
|
752 return NGX_ERROR; |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
753 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
754 |
561 | 755 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
|
756 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
|
757 wev[i].closed = 1; |
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
758 } |
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
759 |
543 | 760 i = cycle->connection_n; |
761 next = NULL; | |
762 | |
763 do { | |
764 i--; | |
765 | |
766 c[i].data = next; | |
561 | 767 c[i].read = &cycle->read_events[i]; |
768 c[i].write = &cycle->write_events[i]; | |
543 | 769 c[i].fd = (ngx_socket_t) -1; |
770 | |
771 next = &c[i]; | |
772 } while (i); | |
773 | |
774 cycle->free_connections = next; | |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
775 cycle->free_connection_n = cycle->connection_n; |
543 | 776 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
777 /* 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
|
778 |
543 | 779 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
|
780 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
|
781 |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
782 #if (NGX_HAVE_REUSEPORT) |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
783 if (ls[i].reuseport && ls[i].worker != ngx_worker) { |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
784 continue; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
785 } |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
786 #endif |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
787 |
543 | 788 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
|
789 |
543 | 790 if (c == NULL) { |
791 return NGX_ERROR; | |
792 } | |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
793 |
6436 | 794 c->type = ls[i].type; |
543 | 795 c->log = &ls[i].log; |
796 | |
797 c->listening = &ls[i]; | |
798 ls[i].connection = c; | |
799 | |
561 | 800 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
|
801 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
802 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
|
803 rev->accept = 1; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
804 |
469 | 805 #if (NGX_HAVE_DEFERRED_ACCEPT) |
543 | 806 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
|
807 #endif |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
808 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
809 if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) { |
543 | 810 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
|
811 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
812 /* |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
813 * 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
|
814 * 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
|
815 */ |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
816 |
543 | 817 old = ls[i].previous->connection; |
818 | |
819 if (ngx_del_event(old->read, NGX_READ_EVENT, NGX_CLOSE_EVENT) | |
820 == NGX_ERROR) | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
821 { |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
822 return NGX_ERROR; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
823 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
824 |
543 | 825 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
|
826 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
827 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
828 |
461 | 829 #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
|
830 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
831 if (ngx_event_flags & NGX_USE_IOCP_EVENT) { |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
832 ngx_iocp_conf_t *iocpcf; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
833 |
509 | 834 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
|
835 |
2771
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
836 if (ngx_use_accept_mutex) { |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
837 continue; |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
838 } |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
839 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
840 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
|
841 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
842 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
843 |
543 | 844 ls[i].log.handler = ngx_acceptex_log_error; |
845 | |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
846 iocpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_iocp_module); |
543 | 847 if (ngx_event_post_acceptex(&ls[i], iocpcf->post_acceptex) |
848 == NGX_ERROR) | |
288
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
276
diff
changeset
|
849 { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
850 return NGX_ERROR; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
851 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
852 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
853 } else { |
509 | 854 rev->handler = ngx_event_accept; |
461 | 855 |
2771
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
856 if (ngx_use_accept_mutex) { |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
857 continue; |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
858 } |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
859 |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
860 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
|
861 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
862 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
863 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
864 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
865 #else |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
866 |
6436 | 867 rev->handler = (c->type == SOCK_STREAM) ? ngx_event_accept |
868 : ngx_event_recvmsg; | |
260
5dacbb4daaf6
nginx-0.0.2-2004-02-17-20:53:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
869 |
6155
193bbc006d5e
Fixed reuseport with accept_mutex.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
870 #if (NGX_HAVE_REUSEPORT) |
6635
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
871 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
872 if (ls[i].reuseport) { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
873 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
874 return NGX_ERROR; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
875 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
876 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
877 continue; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
878 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
879 |
6155
193bbc006d5e
Fixed reuseport with accept_mutex.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
880 #endif |
6635
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
881 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
882 if (ngx_use_accept_mutex) { |
345
fade4edd61f8
nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
883 continue; |
fade4edd61f8
nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
884 } |
344
e366ba5db8f8
nginx-0.0.3-2004-06-01-10:04:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
331
diff
changeset
|
885 |
6635
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
886 #if (NGX_HAVE_EPOLLEXCLUSIVE) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
887 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
888 if ((ngx_event_flags & NGX_USE_EPOLL_EVENT) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
889 && ccf->worker_processes > 1) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
890 { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
891 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_EXCLUSIVE_EVENT) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
892 == NGX_ERROR) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
893 { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
894 return NGX_ERROR; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
895 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
896 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
897 continue; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
898 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
899 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
900 #endif |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
901 |
6126
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
902 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
903 return NGX_ERROR; |
260
5dacbb4daaf6
nginx-0.0.2-2004-02-17-20:53:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
904 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
905 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
906 #endif |
543 | 907 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
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 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
|
911 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
912 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
913 |
509 | 914 ngx_int_t |
915 ngx_send_lowat(ngx_connection_t *c, size_t lowat) | |
452 | 916 { |
917 int sndlowat; | |
918 | |
455 | 919 #if (NGX_HAVE_LOWAT_EVENT) |
452 | 920 |
455 | 921 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
452 | 922 c->write->available = lowat; |
923 return NGX_OK; | |
924 } | |
925 | |
926 #endif | |
577 | 927 |
452 | 928 if (lowat == 0 || c->sndlowat) { |
929 return NGX_OK; | |
930 } | |
931 | |
932 sndlowat = (int) lowat; | |
933 | |
934 if (setsockopt(c->fd, SOL_SOCKET, SO_SNDLOWAT, | |
1092 | 935 (const void *) &sndlowat, sizeof(int)) |
936 == -1) | |
452 | 937 { |
938 ngx_connection_error(c, ngx_socket_errno, | |
939 "setsockopt(SO_SNDLOWAT) failed"); | |
940 return NGX_ERROR; | |
941 } | |
942 | |
943 c->sndlowat = 1; | |
944 | |
945 return NGX_OK; | |
946 } | |
947 | |
948 | |
509 | 949 static char * |
950 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
|
951 { |
501 | 952 char *rv; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
953 void ***ctx; |
501 | 954 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
|
955 ngx_conf_t pcf; |
501 | 956 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
|
957 |
5002
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
958 if (*(void **) conf) { |
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
959 return "is duplicate"; |
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
960 } |
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
961 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
962 /* 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
|
963 |
6378
0f203a2af17c
Dynamic modules: moved module-related stuff to separate files.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6266
diff
changeset
|
964 ngx_event_max_module = ngx_count_modules(cf->cycle, 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
|
965 |
501 | 966 ctx = ngx_pcalloc(cf->pool, sizeof(void *)); |
967 if (ctx == NULL) { | |
968 return NGX_CONF_ERROR; | |
969 } | |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
970 |
501 | 971 *ctx = ngx_pcalloc(cf->pool, ngx_event_max_module * sizeof(void *)); |
972 if (*ctx == NULL) { | |
973 return NGX_CONF_ERROR; | |
974 } | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
975 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
976 *(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
|
977 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
978 for (i = 0; cf->cycle->modules[i]; i++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
979 if (cf->cycle->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
|
980 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
981 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
982 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
983 m = cf->cycle->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
|
984 |
501 | 985 if (m->create_conf) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
986 (*ctx)[cf->cycle->modules[i]->ctx_index] = |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
987 m->create_conf(cf->cycle); |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
988 if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) { |
501 | 989 return NGX_CONF_ERROR; |
990 } | |
91
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 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
993 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
994 pcf = *cf; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
995 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
|
996 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
|
997 cf->cmd_type = NGX_EVENT_CONF; |
501 | 998 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
999 rv = ngx_conf_parse(cf, NULL); |
501 | 1000 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1001 *cf = pcf; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1002 |
6166 | 1003 if (rv != NGX_CONF_OK) { |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1004 return rv; |
6166 | 1005 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1006 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1007 for (i = 0; cf->cycle->modules[i]; i++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1008 if (cf->cycle->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
|
1009 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1010 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1011 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1012 m = cf->cycle->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
|
1013 |
501 | 1014 if (m->init_conf) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1015 rv = m->init_conf(cf->cycle, |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1016 (*ctx)[cf->cycle->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
|
1017 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
|
1018 return rv; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1019 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1020 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1021 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1022 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1023 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
|
1024 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1025 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1026 |
509 | 1027 static char * |
1028 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
|
1029 { |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1030 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
|
1031 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1032 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
|
1033 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1034 if (ecf->connections != NGX_CONF_UNSET_UINT) { |
2024 | 1035 return "is duplicate"; |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1036 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1037 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1038 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
|
1039 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
|
1040 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
|
1041 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 1042 "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
|
1043 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1044 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
|
1045 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1046 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1047 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
|
1048 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1049 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
|
1050 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1051 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1052 |
509 | 1053 static char * |
1054 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
|
1055 { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
1056 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
|
1057 |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
355
diff
changeset
|
1063 if (ecf->use != NGX_CONF_UNSET_UINT) { |
2024 | 1064 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
|
1065 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1066 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1067 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
|
1068 |
227
2ba3477070ac
nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
1069 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
|
1070 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
|
1071 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
|
1072 } else { |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1073 old_ecf = NULL; |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1074 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1075 |
249
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
1076 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1077 for (m = 0; cf->cycle->modules[m]; m++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1078 if (cf->cycle->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
|
1079 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1080 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1081 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1082 module = cf->cycle->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
|
1083 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
|
1084 if (ngx_strcmp(module->name->data, value[1].data) == 0) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1085 ecf->use = cf->cycle->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
|
1086 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
|
1087 |
249
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
1088 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
|
1089 && old_ecf |
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
1090 && 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
|
1091 { |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1092 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
467 | 1093 "when the server runs without a master process " |
1094 "the \"%V\" event type must be the same as " | |
1095 "in previous configuration - \"%s\" " | |
4133
59b99f217c6d
Replaced "can not" with "cannot" and "could not" in a bunch of places.
Ruslan Ermilov <ru@nginx.com>
parents:
3909
diff
changeset
|
1096 "and it cannot be changed on the fly, " |
467 | 1097 "to change it you need to stop server " |
1098 "and start it again", | |
1099 &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
|
1100 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1101 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
|
1102 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1103 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1104 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
|
1105 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1106 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1107 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1108 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1109 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 1110 "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
|
1111 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1112 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
|
1113 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1114 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1115 |
509 | 1116 static char * |
1117 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
|
1118 { |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1119 #if (NGX_DEBUG) |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1120 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
|
1121 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1122 ngx_int_t rc; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1123 ngx_str_t *value; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1124 ngx_url_t u; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1125 ngx_cidr_t c, *cidr; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1126 ngx_uint_t i; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1127 struct sockaddr_in *sin; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1128 #if (NGX_HAVE_INET6) |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1129 struct sockaddr_in6 *sin6; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1130 #endif |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1131 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1132 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
|
1133 |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1134 #if (NGX_HAVE_UNIX_DOMAIN) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1135 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1136 if (ngx_strcmp(value[1].data, "unix:") == 0) { |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1137 cidr = ngx_array_push(&ecf->debug_connection); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1138 if (cidr == NULL) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1139 return NGX_CONF_ERROR; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1140 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1141 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1142 cidr->family = AF_UNIX; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1143 return NGX_CONF_OK; |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1144 } |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1145 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1146 #endif |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1147 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1148 rc = ngx_ptocidr(&value[1], &c); |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1149 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1150 if (rc != NGX_ERROR) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1151 if (rc == NGX_DONE) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1152 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1153 "low address bits of %V are meaningless", |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1154 &value[1]); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1155 } |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1156 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1157 cidr = ngx_array_push(&ecf->debug_connection); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1158 if (cidr == NULL) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1159 return NGX_CONF_ERROR; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1160 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1161 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1162 *cidr = c; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1163 |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1164 return NGX_CONF_OK; |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1165 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1166 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1167 ngx_memzero(&u, sizeof(ngx_url_t)); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1168 u.host = value[1]; |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1169 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1170 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1171 if (u.err) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1172 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1173 "%s in debug_connection \"%V\"", |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1174 u.err, &u.host); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1175 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1176 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1177 return NGX_CONF_ERROR; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1178 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1179 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1180 cidr = ngx_array_push_n(&ecf->debug_connection, u.naddrs); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1181 if (cidr == NULL) { |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1182 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
|
1183 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1184 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1185 ngx_memzero(cidr, u.naddrs * sizeof(ngx_cidr_t)); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1186 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1187 for (i = 0; i < u.naddrs; i++) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1188 cidr[i].family = u.addrs[i].sockaddr->sa_family; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1189 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1190 switch (cidr[i].family) { |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1191 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1192 #if (NGX_HAVE_INET6) |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1193 case AF_INET6: |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1194 sin6 = (struct sockaddr_in6 *) u.addrs[i].sockaddr; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1195 cidr[i].u.in6.addr = sin6->sin6_addr; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1196 ngx_memset(cidr[i].u.in6.mask.s6_addr, 0xff, 16); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1197 break; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1198 #endif |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1199 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1200 default: /* AF_INET */ |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1201 sin = (struct sockaddr_in *) u.addrs[i].sockaddr; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1202 cidr[i].u.in.addr = sin->sin_addr.s_addr; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1203 cidr[i].u.in.mask = 0xffffffff; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1204 break; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1205 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1206 } |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1207 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1208 #else |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1209 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1210 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
|
1211 "\"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
|
1212 "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
|
1213 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1214 #endif |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1215 |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1216 return NGX_CONF_OK; |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1217 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1218 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1219 |
509 | 1220 static void * |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
1221 ngx_event_core_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
|
1222 { |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1223 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
|
1224 |
501 | 1225 ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t)); |
1226 if (ecf == NULL) { | |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2771
diff
changeset
|
1227 return NULL; |
501 | 1228 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1229 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1230 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
|
1231 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
|
1232 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
|
1233 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
|
1234 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
|
1235 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
|
1236 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1237 #if (NGX_DEBUG) |
501 | 1238 |
1239 if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4, | |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1240 sizeof(ngx_cidr_t)) == NGX_ERROR) |
501 | 1241 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2771
diff
changeset
|
1242 return NULL; |
501 | 1243 } |
1244 | |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1245 #endif |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1246 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1247 return ecf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1248 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1249 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1250 |
509 | 1251 static char * |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
1252 ngx_event_core_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
|
1253 { |
354
eaf1f651cf86
nginx-0.0.7-2004-06-15-11:55:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
352
diff
changeset
|
1254 ngx_event_conf_t *ecf = conf; |
467 | 1255 |
501 | 1256 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) |
1257 int fd; | |
1258 #endif | |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1259 ngx_int_t i; |
467 | 1260 ngx_module_t *module; |
1261 ngx_event_module_t *event_module; | |
1262 | |
1263 module = NULL; | |
1264 | |
469 | 1265 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) |
467 | 1266 |
1267 fd = epoll_create(100); | |
1268 | |
1269 if (fd != -1) { | |
4810
e1d11fb9a71f
Explicitly ignore returned value from close() in ngx_event_core_init_conf().
Andrey Belov <defan@nginx.com>
parents:
4763
diff
changeset
|
1270 (void) close(fd); |
467 | 1271 module = &ngx_epoll_module; |
1272 | |
1273 } else if (ngx_errno != NGX_ENOSYS) { | |
1274 module = &ngx_epoll_module; | |
1275 } | |
1276 | |
1277 #endif | |
1278 | |
6465 | 1279 #if (NGX_HAVE_DEVPOLL) && !(NGX_TEST_BUILD_DEVPOLL) |
467 | 1280 |
1281 module = &ngx_devpoll_module; | |
1282 | |
360
239e37d44a34
nginx-0.0.7-2004-06-18-20:22:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
1283 #endif |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1284 |
469 | 1285 #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
|
1286 |
467 | 1287 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
|
1288 |
467 | 1289 #endif |
351
af4c6b45a687
nginx-0.0.4-2004-06-10-22:36:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
346
diff
changeset
|
1290 |
469 | 1291 #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
|
1292 |
467 | 1293 if (module == NULL) { |
1294 module = &ngx_select_module; | |
1295 } | |
1296 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
354
diff
changeset
|
1297 #endif |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1298 |
467 | 1299 if (module == NULL) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1300 for (i = 0; cycle->modules[i]; i++) { |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1301 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1302 if (cycle->modules[i]->type != NGX_EVENT_MODULE) { |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1303 continue; |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1304 } |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1305 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1306 event_module = cycle->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
|
1307 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1308 if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0) |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1309 { |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1310 continue; |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1311 } |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1312 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1313 module = cycle->modules[i]; |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1314 break; |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1315 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1316 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1317 |
467 | 1318 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
|
1319 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
|
1320 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
|
1321 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1322 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1323 ngx_conf_init_uint_value(ecf->connections, DEFAULT_CONNECTIONS); |
467 | 1324 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
|
1325 |
663 | 1326 ngx_conf_init_uint_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
|
1327 |
467 | 1328 event_module = module->ctx; |
1329 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
|
1330 |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
249
diff
changeset
|
1331 ngx_conf_init_value(ecf->multi_accept, 0); |
6633
d82b3c344e7e
Events: the "accept_mutex" directive is turned off by default.
Valentin Bartenev <vbart@nginx.com>
parents:
6480
diff
changeset
|
1332 ngx_conf_init_value(ecf->accept_mutex, 0); |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1333 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
|
1334 |
573 | 1335 return NGX_CONF_OK; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1336 } |