Mercurial > hg > nginx-quic
annotate src/event/ngx_event.c @ 8285:0697294f79a4 quic
QUIC: removed redundant "app" flag from ngx_quic_close_frame_t.
The flag was introduced to create type-aware CONNECTION_CLOSE frames,
and now is replaced with frame type information, directly accessible.
Notably, this fixes type logging for received frames in b3d9e57d0f62.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 03 Feb 2021 12:39:41 +0300 |
parents | 279ad36f2f4b |
children | 05e0988a6898 |
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 { |
7999
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
271 #if (NGX_QUIC) |
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
272 |
7681 | 273 ngx_connection_t *c; |
274 | |
275 c = rev->data; | |
276 | |
8200
279ad36f2f4b
QUIC: renamed c->qs to c->quic.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
277 if (c->quic) { |
7681 | 278 |
279 if (!rev->active && !rev->ready) { | |
280 rev->active = 1; | |
281 | |
282 } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) { | |
283 rev->active = 0; | |
284 } | |
285 | |
286 return NGX_OK; | |
287 } | |
288 | |
7999
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
289 #endif |
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
290 |
509 | 291 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) { |
577 | 292 |
509 | 293 /* kqueue, epoll */ |
294 | |
295 if (!rev->active && !rev->ready) { | |
296 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_CLEAR_EVENT) | |
297 == NGX_ERROR) | |
298 { | |
299 return NGX_ERROR; | |
300 } | |
301 } | |
577 | 302 |
509 | 303 return NGX_OK; |
304 | |
305 } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) { | |
306 | |
307 /* select, poll, /dev/poll */ | |
308 | |
309 if (!rev->active && !rev->ready) { | |
310 if (ngx_add_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT) | |
311 == NGX_ERROR) | |
312 { | |
313 return NGX_ERROR; | |
314 } | |
315 | |
316 return NGX_OK; | |
317 } | |
318 | |
319 if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) { | |
320 if (ngx_del_event(rev, NGX_READ_EVENT, NGX_LEVEL_EVENT | flags) | |
321 == NGX_ERROR) | |
322 { | |
323 return NGX_ERROR; | |
324 } | |
325 | |
326 return NGX_OK; | |
327 } | |
328 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
329 } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) { |
509 | 330 |
331 /* event ports */ | |
332 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
333 if (!rev->active && !rev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
334 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
509 | 335 return NGX_ERROR; |
336 } | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
337 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
338 return NGX_OK; |
509 | 339 } |
577 | 340 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
341 if (rev->oneshot && !rev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
342 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
|
343 return NGX_ERROR; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
344 } |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
345 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
346 return NGX_OK; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
347 } |
509 | 348 } |
349 | |
6126
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
350 /* iocp */ |
509 | 351 |
352 return NGX_OK; | |
353 } | |
354 | |
355 | |
356 ngx_int_t | |
357 ngx_handle_write_event(ngx_event_t *wev, size_t lowat) | |
358 { | |
359 ngx_connection_t *c; | |
360 | |
7681 | 361 c = wev->data; |
362 | |
509 | 363 if (lowat) { |
364 if (ngx_send_lowat(c, lowat) == NGX_ERROR) { | |
365 return NGX_ERROR; | |
366 } | |
367 } | |
368 | |
7999
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
369 #if (NGX_QUIC) |
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
370 |
8200
279ad36f2f4b
QUIC: renamed c->qs to c->quic.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
371 if (c->quic) { |
7681 | 372 |
373 if (!wev->active && !wev->ready) { | |
374 wev->active = 1; | |
375 | |
376 } else if (wev->active && wev->ready) { | |
377 wev->active = 0; | |
378 } | |
379 | |
380 return NGX_OK; | |
381 } | |
382 | |
7999
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
383 #endif |
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
384 |
509 | 385 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) { |
386 | |
387 /* kqueue, epoll */ | |
388 | |
389 if (!wev->active && !wev->ready) { | |
390 if (ngx_add_event(wev, NGX_WRITE_EVENT, | |
391 NGX_CLEAR_EVENT | (lowat ? NGX_LOWAT_EVENT : 0)) | |
392 == NGX_ERROR) | |
393 { | |
394 return NGX_ERROR; | |
395 } | |
396 } | |
397 | |
398 return NGX_OK; | |
399 | |
400 } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) { | |
401 | |
402 /* select, poll, /dev/poll */ | |
403 | |
404 if (!wev->active && !wev->ready) { | |
405 if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT) | |
406 == NGX_ERROR) | |
407 { | |
408 return NGX_ERROR; | |
409 } | |
410 | |
411 return NGX_OK; | |
412 } | |
413 | |
414 if (wev->active && wev->ready) { | |
415 if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_LEVEL_EVENT) | |
416 == NGX_ERROR) | |
417 { | |
418 return NGX_ERROR; | |
419 } | |
420 | |
421 return NGX_OK; | |
422 } | |
423 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
424 } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) { |
509 | 425 |
426 /* event ports */ | |
427 | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
428 if (!wev->active && !wev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
429 if (ngx_add_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) { |
509 | 430 return NGX_ERROR; |
431 } | |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
432 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
433 return NGX_OK; |
509 | 434 } |
577 | 435 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
436 if (wev->oneshot && wev->ready) { |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
437 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
|
438 return NGX_ERROR; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
439 } |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
440 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
441 return NGX_OK; |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
667
diff
changeset
|
442 } |
509 | 443 } |
444 | |
6126
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
445 /* iocp */ |
509 | 446 |
447 return NGX_OK; | |
448 } | |
449 | |
450 | |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
451 static char * |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
452 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
|
453 { |
7315
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
454 #if (NGX_HAVE_REUSEPORT) |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
455 ngx_uint_t i; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
456 ngx_listening_t *ls; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
457 #endif |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
458 |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
459 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
|
460 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
|
461 "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
|
462 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
|
463 } |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
464 |
7316
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
465 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
|
466 |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
467 /* |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
468 * 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
|
469 * 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
|
470 */ |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
471 |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
472 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
|
473 "%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
|
474 "for %ui listening sockets", |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
475 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
|
476 |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
477 return NGX_CONF_ERROR; |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
478 } |
8f152ca81f5f
Events: added configuration check on the number of connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7315
diff
changeset
|
479 |
7315
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
480 #if (NGX_HAVE_REUSEPORT) |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
481 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
482 ls = cycle->listening.elts; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
483 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
|
484 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
485 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
|
486 continue; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
487 } |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
488 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
489 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
|
490 return NGX_CONF_ERROR; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
491 } |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
492 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
493 /* 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
|
494 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
495 ls = cycle->listening.elts; |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
496 } |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
497 |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
498 #endif |
e7b2b907c0f8
Events: moved sockets cloning to ngx_event_init_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
6947
diff
changeset
|
499 |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
500 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
|
501 } |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
502 |
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
503 |
509 | 504 static ngx_int_t |
505 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
|
506 { |
543 | 507 void ***cf; |
605 | 508 u_char *shared; |
611 | 509 size_t size, cl; |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
510 ngx_shm_t shm; |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
511 ngx_time_t *tp; |
563 | 512 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
|
513 ngx_event_conf_t *ecf; |
473 | 514 |
515 cf = ngx_get_conf(cycle->conf_ctx, ngx_events_module); | |
516 ecf = (*cf)[ngx_event_core_module.ctx_index]; | |
517 | |
2725 | 518 if (!ngx_test_config && ngx_process <= NGX_PROCESS_MASTER) { |
641 | 519 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, |
520 "using the \"%s\" event method", ecf->name); | |
521 } | |
473 | 522 |
563 | 523 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
|
524 |
563 | 525 ngx_timer_resolution = ccf->timer_resolution; |
526 | |
527 #if !(NGX_WIN32) | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
528 { |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
529 ngx_int_t limit; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
530 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
|
531 |
543 | 532 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) { |
533 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
534 "getrlimit(RLIMIT_NOFILE) failed, ignored"); | |
535 | |
536 } else { | |
537 if (ecf->connections > (ngx_uint_t) rlmt.rlim_cur | |
538 && (ccf->rlimit_nofile == NGX_CONF_UNSET | |
539 || ecf->connections > (ngx_uint_t) ccf->rlimit_nofile)) | |
540 { | |
541 limit = (ccf->rlimit_nofile == NGX_CONF_UNSET) ? | |
542 (ngx_int_t) rlmt.rlim_cur : ccf->rlimit_nofile; | |
543 | |
544 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
|
545 "%ui worker_connections exceed " |
543 | 546 "open file resource limit: %i", |
547 ecf->connections, limit); | |
548 } | |
549 } | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
550 } |
605 | 551 #endif /* !(NGX_WIN32) */ |
552 | |
543 | 553 |
611 | 554 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
|
555 return NGX_OK; |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
556 } |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
557 |
611 | 558 if (ngx_accept_mutex_ptr) { |
559 return NGX_OK; | |
560 } | |
561 | |
562 | |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
563 /* cl should be equal to or greater than cache line size */ |
611 | 564 |
565 cl = 128; | |
566 | |
567 size = cl /* ngx_accept_mutex */ | |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
568 + cl /* ngx_connection_counter */ |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
569 + 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
|
570 |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
571 #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
|
572 |
611 | 573 size += cl /* ngx_stat_accepted */ |
574 + cl /* ngx_stat_handled */ | |
575 + cl /* ngx_stat_requests */ | |
576 + cl /* ngx_stat_active */ | |
577 + cl /* ngx_stat_reading */ | |
5115
a29c574d61fa
Status: introduced the "ngx_stat_waiting" counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5002
diff
changeset
|
578 + cl /* ngx_stat_writing */ |
a29c574d61fa
Status: introduced the "ngx_stat_waiting" counter.
Valentin Bartenev <vbart@nginx.com>
parents:
5002
diff
changeset
|
579 + 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
|
580 |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
581 #endif |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
582 |
605 | 583 shm.size = size; |
6947
a8d7c9139831
Core: set nginx_shared_zone name via ngx_str_set().
Ruslan Ermilov <ru@nginx.com>
parents:
6922
diff
changeset
|
584 ngx_str_set(&shm.name, "nginx_shared_zone"); |
605 | 585 shm.log = cycle->log; |
586 | |
587 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
|
588 return NGX_ERROR; |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
589 } |
309
2e899477243a
nginx-0.0.3-2004-04-09-20:03:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
590 |
605 | 591 shared = shm.addr; |
592 | |
330
377a955421dc
nginx-0.0.3-2004-04-29-20:34:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
325
diff
changeset
|
593 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
|
594 ngx_accept_mutex.spin = (ngx_uint_t) -1; |
611 | 595 |
4309
3f6040cd731e
Added shmtx interface to forcibly unlock mutexes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
596 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
|
597 cycle->lock_file.data) |
611 | 598 != NGX_OK) |
599 { | |
600 return NGX_ERROR; | |
601 } | |
602 | |
603 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
|
604 |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2537
diff
changeset
|
605 (void) ngx_atomic_cmp_set(ngx_connection_counter, 0, 1); |
563 | 606 |
325
7c3323909107
nginx-0.0.3-2004-04-23-20:50:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
607 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
6480 | 608 "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
|
609 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
|
610 |
3035
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
611 ngx_temp_number = (ngx_atomic_t *) (shared + 2 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
612 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
613 tp = ngx_timeofday(); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
614 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
615 ngx_random_number = (tp->msec << 16) + ngx_pid; |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
616 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
617 #if (NGX_STAT_STUB) |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
618 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
619 ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
620 ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
621 ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
622 ngx_stat_active = (ngx_atomic_t *) (shared + 6 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
623 ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * cl); |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
624 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
|
625 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
|
626 |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
627 #endif |
f9d97311c652
*) share temporary number between workers
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
628 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
629 return NGX_OK; |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
630 } |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
631 |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
632 |
563 | 633 #if !(NGX_WIN32) |
634 | |
4759
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4613
diff
changeset
|
635 static void |
563 | 636 ngx_timer_signal_handler(int signo) |
637 { | |
638 ngx_event_timer_alarm = 1; | |
639 | |
640 #if 1 | |
641 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0, "timer signal"); | |
642 #endif | |
643 } | |
644 | |
645 #endif | |
646 | |
647 | |
509 | 648 static ngx_int_t |
649 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
|
650 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
651 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
|
652 ngx_event_t *rev, *wev; |
543 | 653 ngx_listening_t *ls; |
654 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
|
655 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
|
656 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
|
657 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
|
658 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
659 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
|
660 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
|
661 |
865 | 662 if (ccf->master && ccf->worker_processes > 1 && ecf->accept_mutex) { |
611 | 663 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
|
664 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
|
665 ngx_accept_mutex_delay = ecf->accept_mutex_delay; |
611 | 666 |
667 } else { | |
668 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
|
669 } |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
670 |
5235
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
671 #if (NGX_WIN32) |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
672 |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
673 /* |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
674 * 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
|
675 * 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
|
676 */ |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
677 |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
678 ngx_use_accept_mutex = 0; |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
679 |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
680 #endif |
c9fe549b127b
Win32: accept_mutex now always disabled (ticket #362).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5115
diff
changeset
|
681 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
682 ngx_queue_init(&ngx_posted_accept_events); |
7584
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7316
diff
changeset
|
683 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
|
684 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
|
685 |
270
7bb9562216ce
nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
260
diff
changeset
|
686 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
|
687 return NGX_ERROR; |
7bb9562216ce
nginx-0.0.2-2004-02-25-23:16:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
260
diff
changeset
|
688 } |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
689 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
690 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
|
691 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
|
692 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
693 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
694 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
695 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
|
696 continue; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
697 } |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
698 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
699 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
|
700 |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
701 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
|
702 /* fatal */ |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
703 exit(2); |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
704 } |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
705 |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
706 break; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
707 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
708 |
543 | 709 #if !(NGX_WIN32) |
710 | |
563 | 711 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
|
712 struct sigaction sa; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
713 struct itimerval itv; |
563 | 714 |
715 ngx_memzero(&sa, sizeof(struct sigaction)); | |
716 sa.sa_handler = ngx_timer_signal_handler; | |
717 sigemptyset(&sa.sa_mask); | |
718 | |
719 if (sigaction(SIGALRM, &sa, NULL) == -1) { | |
720 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
721 "sigaction(SIGALRM) failed"); | |
722 return NGX_ERROR; | |
723 } | |
724 | |
725 itv.it_interval.tv_sec = ngx_timer_resolution / 1000; | |
726 itv.it_interval.tv_usec = (ngx_timer_resolution % 1000) * 1000; | |
727 itv.it_value.tv_sec = ngx_timer_resolution / 1000; | |
728 itv.it_value.tv_usec = (ngx_timer_resolution % 1000 ) * 1000; | |
729 | |
730 if (setitimer(ITIMER_REAL, &itv, NULL) == -1) { | |
731 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
732 "setitimer() failed"); | |
577 | 733 } |
563 | 734 } |
735 | |
543 | 736 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
|
737 struct rlimit rlmt; |
543 | 738 |
739 if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) { | |
740 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
741 "getrlimit(RLIMIT_NOFILE) failed"); | |
742 return NGX_ERROR; | |
743 } | |
744 | |
745 cycle->files_n = (ngx_uint_t) rlmt.rlim_cur; | |
746 | |
747 cycle->files = ngx_calloc(sizeof(ngx_connection_t *) * cycle->files_n, | |
748 cycle->log); | |
749 if (cycle->files == NULL) { | |
750 return NGX_ERROR; | |
751 } | |
752 } | |
753 | |
6266
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
754 #else |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
755 |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
756 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
|
757 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
|
758 "the \"timer_resolution\" directive is not supported " |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
759 "with the configured event method, ignored"); |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
760 ngx_timer_resolution = 0; |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
761 } |
dceb078b1156
Win32: timer_resolution now ignored with select.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6166
diff
changeset
|
762 |
543 | 763 #endif |
764 | |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
765 cycle->connections = |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
766 ngx_alloc(sizeof(ngx_connection_t) * cycle->connection_n, cycle->log); |
561 | 767 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
|
768 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
|
769 } |
da763a85be66
nginx-0.0.1-2003-07-04-10:03:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
109
diff
changeset
|
770 |
561 | 771 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
|
772 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
773 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
|
774 cycle->log); |
561 | 775 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
|
776 return NGX_ERROR; |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
777 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
778 |
561 | 779 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
|
780 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
|
781 rev[i].closed = 1; |
481 | 782 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
|
783 } |
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
784 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
785 cycle->write_events = ngx_alloc(sizeof(ngx_event_t) * cycle->connection_n, |
481 | 786 cycle->log); |
561 | 787 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
|
788 return NGX_ERROR; |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
789 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
790 |
561 | 791 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
|
792 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
|
793 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
|
794 } |
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
795 |
543 | 796 i = cycle->connection_n; |
797 next = NULL; | |
798 | |
799 do { | |
800 i--; | |
801 | |
802 c[i].data = next; | |
561 | 803 c[i].read = &cycle->read_events[i]; |
804 c[i].write = &cycle->write_events[i]; | |
543 | 805 c[i].fd = (ngx_socket_t) -1; |
806 | |
807 next = &c[i]; | |
808 } while (i); | |
809 | |
810 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
|
811 cycle->free_connection_n = cycle->connection_n; |
543 | 812 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
813 /* 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
|
814 |
543 | 815 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
|
816 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
|
817 |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
818 #if (NGX_HAVE_REUSEPORT) |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
819 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
|
820 continue; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
821 } |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
822 #endif |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6139
diff
changeset
|
823 |
543 | 824 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
|
825 |
543 | 826 if (c == NULL) { |
827 return NGX_ERROR; | |
828 } | |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
829 |
6436 | 830 c->type = ls[i].type; |
543 | 831 c->log = &ls[i].log; |
832 | |
833 c->listening = &ls[i]; | |
834 ls[i].connection = c; | |
835 | |
561 | 836 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
|
837 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
838 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
|
839 rev->accept = 1; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
840 |
469 | 841 #if (NGX_HAVE_DEFERRED_ACCEPT) |
543 | 842 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
|
843 #endif |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
844 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
845 if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) { |
543 | 846 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
|
847 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
848 /* |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
849 * 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
|
850 * 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
|
851 */ |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
852 |
543 | 853 old = ls[i].previous->connection; |
854 | |
855 if (ngx_del_event(old->read, NGX_READ_EVENT, NGX_CLOSE_EVENT) | |
856 == NGX_ERROR) | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
857 { |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
858 return NGX_ERROR; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
859 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
860 |
543 | 861 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
|
862 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
863 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
864 |
461 | 865 #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
|
866 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
867 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
|
868 ngx_iocp_conf_t *iocpcf; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1380
diff
changeset
|
869 |
509 | 870 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
|
871 |
2771
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
872 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
|
873 continue; |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
874 } |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
875 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
876 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
|
877 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
878 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
879 |
543 | 880 ls[i].log.handler = ngx_acceptex_log_error; |
881 | |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
882 iocpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_iocp_module); |
543 | 883 if (ngx_event_post_acceptex(&ls[i], iocpcf->post_acceptex) |
884 == NGX_ERROR) | |
288
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
276
diff
changeset
|
885 { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
886 return NGX_ERROR; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
887 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
888 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
889 } else { |
509 | 890 rev->handler = ngx_event_accept; |
461 | 891 |
2771
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
892 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
|
893 continue; |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
894 } |
4d62ef39f08b
add listen events for win32 only after accept mutex is hold
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
895 |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
896 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
|
897 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
898 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
899 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
900 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
901 #else |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
902 |
6436 | 903 rev->handler = (c->type == SOCK_STREAM) ? ngx_event_accept |
904 : 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
|
905 |
6155
193bbc006d5e
Fixed reuseport with accept_mutex.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
906 #if (NGX_HAVE_REUSEPORT) |
6635
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
907 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
908 if (ls[i].reuseport) { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
909 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
|
910 return NGX_ERROR; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
911 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
912 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
913 continue; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
914 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
915 |
6155
193bbc006d5e
Fixed reuseport with accept_mutex.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
916 #endif |
6635
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
917 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
918 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
|
919 continue; |
fade4edd61f8
nginx-0.0.3-2004-06-04-18:57:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
920 } |
344
e366ba5db8f8
nginx-0.0.3-2004-06-01-10:04:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
331
diff
changeset
|
921 |
6635
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
922 #if (NGX_HAVE_EPOLLEXCLUSIVE) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
923 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
924 if ((ngx_event_flags & NGX_USE_EPOLL_EVENT) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
925 && ccf->worker_processes > 1) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
926 { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
927 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
|
928 == NGX_ERROR) |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
929 { |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
930 return NGX_ERROR; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
931 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
932 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
933 continue; |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
934 } |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
935 |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
936 #endif |
6acaa638fa07
Events: support for EPOLLEXCLUSIVE.
Valentin Bartenev <vbart@nginx.com>
parents:
6633
diff
changeset
|
937 |
6126
adba26ff70b5
Removed the obsolete rtsig module.
Ruslan Ermilov <ru@nginx.com>
parents:
6125
diff
changeset
|
938 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
|
939 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
|
940 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
941 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
942 #endif |
543 | 943 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
944 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
945 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
946 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
|
947 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
948 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
949 |
509 | 950 ngx_int_t |
951 ngx_send_lowat(ngx_connection_t *c, size_t lowat) | |
452 | 952 { |
953 int sndlowat; | |
954 | |
7999
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
955 #if (NGX_QUIC) |
8200
279ad36f2f4b
QUIC: renamed c->qs to c->quic.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
956 if (c->quic) { |
7681 | 957 return NGX_OK; |
958 } | |
7999
0d2b2664b41c
QUIC: added "quic" listen parameter.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
959 #endif |
7681 | 960 |
455 | 961 #if (NGX_HAVE_LOWAT_EVENT) |
452 | 962 |
455 | 963 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
452 | 964 c->write->available = lowat; |
965 return NGX_OK; | |
966 } | |
967 | |
968 #endif | |
577 | 969 |
452 | 970 if (lowat == 0 || c->sndlowat) { |
971 return NGX_OK; | |
972 } | |
973 | |
974 sndlowat = (int) lowat; | |
975 | |
976 if (setsockopt(c->fd, SOL_SOCKET, SO_SNDLOWAT, | |
1092 | 977 (const void *) &sndlowat, sizeof(int)) |
978 == -1) | |
452 | 979 { |
980 ngx_connection_error(c, ngx_socket_errno, | |
981 "setsockopt(SO_SNDLOWAT) failed"); | |
982 return NGX_ERROR; | |
983 } | |
984 | |
985 c->sndlowat = 1; | |
986 | |
987 return NGX_OK; | |
988 } | |
989 | |
990 | |
509 | 991 static char * |
992 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
|
993 { |
501 | 994 char *rv; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
995 void ***ctx; |
501 | 996 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
|
997 ngx_conf_t pcf; |
501 | 998 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
|
999 |
5002
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
1000 if (*(void **) conf) { |
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
1001 return "is duplicate"; |
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
1002 } |
39c597272c8d
Events: added check for duplicate "events" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4810
diff
changeset
|
1003 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1004 /* 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
|
1005 |
6378
0f203a2af17c
Dynamic modules: moved module-related stuff to separate files.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6266
diff
changeset
|
1006 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
|
1007 |
501 | 1008 ctx = ngx_pcalloc(cf->pool, sizeof(void *)); |
1009 if (ctx == NULL) { | |
1010 return NGX_CONF_ERROR; | |
1011 } | |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1012 |
501 | 1013 *ctx = ngx_pcalloc(cf->pool, ngx_event_max_module * sizeof(void *)); |
1014 if (*ctx == NULL) { | |
1015 return NGX_CONF_ERROR; | |
1016 } | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1017 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1018 *(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
|
1019 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1020 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
|
1021 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
|
1022 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1023 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1024 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1025 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
|
1026 |
501 | 1027 if (m->create_conf) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1028 (*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
|
1029 m->create_conf(cf->cycle); |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1030 if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) { |
501 | 1031 return NGX_CONF_ERROR; |
1032 } | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1033 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1034 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1035 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1036 pcf = *cf; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1037 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
|
1038 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
|
1039 cf->cmd_type = NGX_EVENT_CONF; |
501 | 1040 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1041 rv = ngx_conf_parse(cf, NULL); |
501 | 1042 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1043 *cf = pcf; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1044 |
6166 | 1045 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
|
1046 return rv; |
6166 | 1047 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1048 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1049 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
|
1050 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
|
1051 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1052 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1053 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1054 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
|
1055 |
501 | 1056 if (m->init_conf) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1057 rv = m->init_conf(cf->cycle, |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1058 (*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
|
1059 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
|
1060 return rv; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1061 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1062 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1063 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1064 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
1065 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
|
1066 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1067 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1068 |
509 | 1069 static char * |
1070 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
|
1071 { |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1072 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
|
1073 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1074 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
|
1075 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1076 if (ecf->connections != NGX_CONF_UNSET_UINT) { |
2024 | 1077 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
|
1078 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1079 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1080 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
|
1081 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
|
1082 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
|
1083 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 1084 "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
|
1085 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1086 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
|
1087 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1088 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1089 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
|
1090 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1091 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
|
1092 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1093 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1094 |
509 | 1095 static char * |
1096 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
|
1097 { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
1098 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
|
1099 |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1100 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
|
1101 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
|
1102 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
|
1103 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
|
1104 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
355
diff
changeset
|
1105 if (ecf->use != NGX_CONF_UNSET_UINT) { |
2024 | 1106 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
|
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 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
|
1110 |
227
2ba3477070ac
nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
1111 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
|
1112 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
|
1113 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
|
1114 } else { |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1115 old_ecf = NULL; |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1116 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1117 |
249
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
1118 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1119 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
|
1120 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
|
1121 continue; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1122 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1123 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1124 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
|
1125 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
|
1126 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
|
1127 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
|
1128 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
|
1129 |
249
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
1130 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
|
1131 && old_ecf |
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
1132 && 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
|
1133 { |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1134 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
467 | 1135 "when the server runs without a master process " |
1136 "the \"%V\" event type must be the same as " | |
1137 "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
|
1138 "and it cannot be changed on the fly, " |
467 | 1139 "to change it you need to stop server " |
1140 "and start it again", | |
1141 &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
|
1142 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1143 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
|
1144 } |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1145 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1146 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
|
1147 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1148 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1149 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1150 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1151 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 1152 "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
|
1153 |
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
205
diff
changeset
|
1154 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
|
1155 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1156 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1157 |
509 | 1158 static char * |
1159 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
|
1160 { |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1161 #if (NGX_DEBUG) |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1162 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
|
1163 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1164 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
|
1165 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
|
1166 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
|
1167 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
|
1168 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
|
1169 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
|
1170 #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
|
1171 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
|
1172 #endif |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1173 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1174 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
|
1175 |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1176 #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
|
1177 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1178 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
|
1179 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
|
1180 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
|
1181 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
|
1182 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1183 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1184 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
|
1185 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
|
1186 } |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1187 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1188 #endif |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4599
diff
changeset
|
1189 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1190 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
|
1191 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1192 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
|
1193 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
|
1194 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
|
1195 "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
|
1196 &value[1]); |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1197 } |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1198 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1199 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
|
1200 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
|
1201 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
|
1202 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1203 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1204 *cidr = c; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1205 |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1206 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
|
1207 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1208 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1209 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
|
1210 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
|
1211 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1212 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
|
1213 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
|
1214 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
|
1215 "%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
|
1216 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
|
1217 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1218 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1219 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
|
1220 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1221 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1222 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
|
1223 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
|
1224 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
|
1225 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1226 |
4763
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1227 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
|
1228 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1229 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
|
1230 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
|
1231 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1232 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
|
1233 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1234 #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
|
1235 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
|
1236 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
|
1237 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
|
1238 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
|
1239 break; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1240 #endif |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1241 |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1242 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
|
1243 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
|
1244 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
|
1245 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
|
1246 break; |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1247 } |
b0b93b2a1f8a
When "debug_connection" is configured with a domain name, only the first
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
1248 } |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1249 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1250 #else |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1251 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1252 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
|
1253 "\"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
|
1254 "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
|
1255 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1256 #endif |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1257 |
1380
b590a528fd41
ignore meaningless bits in CIDR and warn about them
Igor Sysoev <igor@sysoev.ru>
parents:
1354
diff
changeset
|
1258 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
|
1259 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1260 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1261 |
509 | 1262 static void * |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
1263 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
|
1264 { |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1265 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
|
1266 |
501 | 1267 ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t)); |
1268 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
|
1269 return NULL; |
501 | 1270 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1271 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1272 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
|
1273 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
|
1274 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
|
1275 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
|
1276 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
|
1277 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
|
1278 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1279 #if (NGX_DEBUG) |
501 | 1280 |
1281 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
|
1282 sizeof(ngx_cidr_t)) == NGX_ERROR) |
501 | 1283 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2771
diff
changeset
|
1284 return NULL; |
501 | 1285 } |
1286 | |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1287 #endif |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
1288 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1289 return ecf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1290 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1291 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1292 |
509 | 1293 static char * |
4599
f947296f6b2b
Fixed master exit if there is no events section (ticket #150).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
1294 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
|
1295 { |
354
eaf1f651cf86
nginx-0.0.7-2004-06-15-11:55:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
352
diff
changeset
|
1296 ngx_event_conf_t *ecf = conf; |
467 | 1297 |
501 | 1298 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) |
1299 int fd; | |
1300 #endif | |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1301 ngx_int_t i; |
467 | 1302 ngx_module_t *module; |
1303 ngx_event_module_t *event_module; | |
1304 | |
1305 module = NULL; | |
1306 | |
469 | 1307 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) |
467 | 1308 |
1309 fd = epoll_create(100); | |
1310 | |
1311 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
|
1312 (void) close(fd); |
467 | 1313 module = &ngx_epoll_module; |
1314 | |
1315 } else if (ngx_errno != NGX_ENOSYS) { | |
1316 module = &ngx_epoll_module; | |
1317 } | |
1318 | |
1319 #endif | |
1320 | |
6465 | 1321 #if (NGX_HAVE_DEVPOLL) && !(NGX_TEST_BUILD_DEVPOLL) |
467 | 1322 |
1323 module = &ngx_devpoll_module; | |
1324 | |
360
239e37d44a34
nginx-0.0.7-2004-06-18-20:22:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
1325 #endif |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1326 |
469 | 1327 #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
|
1328 |
467 | 1329 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
|
1330 |
467 | 1331 #endif |
351
af4c6b45a687
nginx-0.0.4-2004-06-10-22:36:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
346
diff
changeset
|
1332 |
469 | 1333 #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
|
1334 |
467 | 1335 if (module == NULL) { |
1336 module = &ngx_select_module; | |
1337 } | |
1338 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
354
diff
changeset
|
1339 #endif |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
1340 |
467 | 1341 if (module == NULL) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1342 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
|
1343 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1344 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
|
1345 continue; |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1346 } |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1347 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1348 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
|
1349 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1350 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
|
1351 { |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1352 continue; |
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1353 } |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1354 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6378
diff
changeset
|
1355 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
|
1356 break; |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1357 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1358 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1359 |
467 | 1360 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
|
1361 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
|
1362 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
|
1363 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1364 |
2062
90312b616162
prepare to allow various number of connections in child processes
Igor Sysoev <igor@sysoev.ru>
parents:
2024
diff
changeset
|
1365 ngx_conf_init_uint_value(ecf->connections, DEFAULT_CONNECTIONS); |
467 | 1366 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
|
1367 |
663 | 1368 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
|
1369 |
467 | 1370 event_module = module->ctx; |
1371 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
|
1372 |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
249
diff
changeset
|
1373 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
|
1374 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
|
1375 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
|
1376 |
573 | 1377 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
|
1378 } |