annotate src/event/ngx_event.c @ 216:f1d0e5f09c1e

nginx-0.0.1-2003-12-25-23:26:58 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 25 Dec 2003 20:26:58 +0000
parents e1c815be05ae
children 05592fd7a436
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 #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
3 #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
4 #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
5
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
6
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
7 #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
8
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9
97
70d2345a903f nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 96
diff changeset
10 extern ngx_module_t ngx_select_module;
216
f1d0e5f09c1e nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents: 209
diff changeset
11 extern ngx_event_module_t ngx_select_module_ctx;
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
12
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13 #if (HAVE_KQUEUE)
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 #include <ngx_kqueue_module.h>
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15 #endif
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
17 #if (HAVE_DEVPOLL)
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
18 extern ngx_module_t ngx_devpoll_module;
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
19 #endif
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
20
63
36d2c25cc9bb nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 60
diff changeset
21 #if (HAVE_AIO)
36d2c25cc9bb nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 60
diff changeset
22 #include <ngx_aio_module.h>
36d2c25cc9bb nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 60
diff changeset
23 #endif
36d2c25cc9bb nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 60
diff changeset
24
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
25 static int ngx_event_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,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
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);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
31
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
32 static void *ngx_event_create_conf(ngx_cycle_t *cycle);
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
33 static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
34
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
35
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
36 int ngx_event_flags;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
37 ngx_event_actions_t ngx_event_actions;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
38
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
39
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
40 static int ngx_event_max_module;
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
43
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
44 static ngx_str_t events_name = ngx_string("events");
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
45
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
46 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
47
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
48 { ngx_string("events"),
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
49 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
50 ngx_events_block,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
51 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
52 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
53 NULL },
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
54
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
55 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
56 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
57
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
58
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
59 ngx_module_t ngx_events_module = {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
60 NGX_MODULE,
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
61 &events_name, /* module context */
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
62 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
63 NGX_CORE_MODULE, /* module type */
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
64 NULL, /* init module */
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
65 NULL /* init child */
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
66 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
67
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
68
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
69 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
70
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
71 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
72
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
73 { ngx_string("connections"),
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
74 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
75 ngx_event_connections,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
76 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
77 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
78 NULL },
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
79
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
80 { ngx_string("use"),
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
81 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
82 ngx_event_use,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
83 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
84 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
85 NULL },
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
86
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
87 ngx_null_command
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
88 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
89
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
90
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
91 ngx_event_module_t ngx_event_core_module_ctx = {
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
92 &event_core_name,
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
93 ngx_event_create_conf, /* create configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
94 ngx_event_init_conf, /* init configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
95
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
96 { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
97 };
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
98
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
99
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
100 ngx_module_t ngx_event_core_module = {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
101 NGX_MODULE,
107
b5be4b0448d3 nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 105
diff changeset
102 &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
103 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
104 NGX_EVENT_MODULE, /* module type */
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
105 NULL, /* init module */
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
106 ngx_event_init /* init child */
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
107 };
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
108
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
109
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
110 static int ngx_event_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
111 {
97
70d2345a903f nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 96
diff changeset
112 int m, i, fd;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
113 ngx_event_t *rev, *wev;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
114 ngx_listening_t *s;
97
70d2345a903f nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 96
diff changeset
115 ngx_connection_t *c;
70d2345a903f nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 96
diff changeset
116 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
117 ngx_event_module_t *module;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
118 #if (WIN32)
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
119 ngx_iocp_conf_t *iocpcf;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
120 #endif
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
121
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
122
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
123 if (cycle->old_cycle == NULL) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
124 ngx_event_timer_init(cycle);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
125 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
126
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
127
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
128 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
129
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
130 cycle->connection_n = ecf->connections;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
131
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
132 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
133 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
134 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
135 }
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
136
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
137 if (ngx_modules[m]->ctx_index == ecf->use) {
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
138 module = ngx_modules[m]->ctx;
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
139 if (module->actions.init(cycle) == NGX_ERROR) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
140 return NGX_ERROR;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
141 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
142 break;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
143 }
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 39
diff changeset
144 }
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
145
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
146 cycle->connections = ngx_alloc(sizeof(ngx_connection_t) * ecf->connections,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
147 cycle->log);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
148 if (cycle->connections == NULL) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
149 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
150 }
da763a85be66 nginx-0.0.1-2003-07-04-10:03:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 109
diff changeset
151
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
152 c = cycle->connections;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
153 for (i = 0; i < cycle->connection_n; i++) {
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
154 c[i].fd = -1;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
155 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
156
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
157 cycle->read_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
158 cycle->log);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
159 if (cycle->read_events == NULL) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
160 return NGX_ERROR;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
161 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
162
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
163 cycle->write_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
164 cycle->log);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
165 if (cycle->write_events == NULL) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
166 return NGX_ERROR;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
167 }
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
168
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
169 /* 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
170
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
171 s = cycle->listening.elts;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
172 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
173
34a521b1a148 nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents: 0
diff changeset
174 fd = s[i].fd;
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
175
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
176 #if (WIN32)
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
177 /*
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
178 * Winsock assignes a socket number divisible by 4
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
179 * so to find a connection we divide a socket number by 4.
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
180 */
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
181
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
182 fd /= 4;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
183 #endif
36
c14d7232b11f nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents: 34
diff changeset
184
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
185 c = &cycle->connections[fd];
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
186 rev = &cycle->read_events[fd];
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
187 wev = &cycle->write_events[fd];
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
188
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 39
diff changeset
189 ngx_memzero(c, sizeof(ngx_connection_t));
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
190 ngx_memzero(rev, sizeof(ngx_event_t));
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
191
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
192 c->fd = s[i].fd;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
193 c->listening = &s[i];
6
669801705ab1 nginx-0.0.1-2002-08-26-19:18:19 import
Igor Sysoev <igor@sysoev.ru>
parents: 4
diff changeset
194
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 39
diff changeset
195 c->ctx = s[i].ctx;
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 39
diff changeset
196 c->servers = s[i].servers;
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 39
diff changeset
197 c->log = s[i].log;
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
198 c->read = rev;
6
669801705ab1 nginx-0.0.1-2002-08-26-19:18:19 import
Igor Sysoev <igor@sysoev.ru>
parents: 4
diff changeset
199
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
200 /* required by iocp in "c->write->active = 1" */
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
201 c->write = wev;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
202
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
203 /* required by poll */
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
204 wev->index = NGX_INVALID_INDEX;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
205
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
206 rev->log = c->log;
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
207 rev->data = c;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
208 rev->index = NGX_INVALID_INDEX;
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
209
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
210 rev->available = 0;
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
211
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
212 #if (HAVE_DEFERRED_ACCEPT)
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
213 rev->deferred_accept = s[i].deferred_accept;
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
214 #endif
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
215
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
216 if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
217 if (s[i].remain) {
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
218
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
219 /*
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
220 * 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
221 * 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
222 */
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
223
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
224 if (ngx_del_event(&cycle->old_cycle->read_events[fd],
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
225 NGX_READ_EVENT, 0) == NGX_ERROR) {
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
226 return NGX_ERROR;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
227 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
228
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
229 cycle->old_cycle->connections[fd].fd = -1;
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
230 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
231 }
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
232
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
233 #if (WIN32)
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
234
144
ef8c87afcfc5 nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents: 114
diff changeset
235 if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
236 rev->event_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
237
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
238 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
239 return NGX_ERROR;
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
240 }
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
241
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
242 iocpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_iocp_module);
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
243 if (ngx_event_post_acceptex(&s[i], iocpcf->acceptex) == NGX_ERROR) {
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
244 return NGX_ERROR;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
245 }
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
246
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
247 } else {
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
248 rev->event_handler = &ngx_event_accept;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
249 ngx_add_event(rev, NGX_READ_EVENT, 0);
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
250 }
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
251
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
252 #else
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
253
103
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
254 rev->event_handler = &ngx_event_accept;
6dfda4cf5200 nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents: 102
diff changeset
255 ngx_add_event(rev, NGX_READ_EVENT, 0);
59
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
256
e8cdc2989cee nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents: 57
diff changeset
257 #endif
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
258 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
259
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
260 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
261 }
0
4eff17414a43 nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
262
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
263
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
264 static char *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
265 {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
266 int m;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
267 char *rv;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
268 void ***ctx;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
269 ngx_conf_t pcf;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
270 ngx_event_module_t *module;
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
271
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
272 /* 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
273
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
274 ngx_event_max_module = 0;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
275 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
276 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
277 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
278 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
279
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
280 ngx_modules[m]->ctx_index = ngx_event_max_module++;
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
281 }
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
282
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
283 ngx_test_null(ctx, ngx_pcalloc(cf->pool, sizeof(void *)), NGX_CONF_ERROR);
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
284
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
285 ngx_test_null(*ctx,
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
286 ngx_pcalloc(cf->pool, ngx_event_max_module * sizeof(void *)),
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
287 NGX_CONF_ERROR);
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
288
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
289 *(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
290
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
291 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
292 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
293 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
294 }
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
295
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
296 module = ngx_modules[m]->ctx;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
297
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
298 if (module->create_conf) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
299 ngx_test_null((*ctx)[ngx_modules[m]->ctx_index],
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
300 module->create_conf(cf->cycle),
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
301 NGX_CONF_ERROR);
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
302 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
303 }
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
304
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
305 pcf = *cf;
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
306 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
307 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
308 cf->cmd_type = NGX_EVENT_CONF;
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
309 rv = ngx_conf_parse(cf, NULL);
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
310 *cf = pcf;
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
311
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
312 if (rv != NGX_CONF_OK)
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
313 return rv;
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
314
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
315 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
316 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
317 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
318 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
319
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
320 module = ngx_modules[m]->ctx;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
321
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
322 if (module->init_conf) {
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
323 rv = module->init_conf(cf->cycle,
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
324 (*ctx)[ngx_modules[m]->ctx_index]);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
325 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
326 return rv;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
327 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
328 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
329 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
330
90
37530da31268 nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents: 87
diff changeset
331 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
332 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
333
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
334
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
335 static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
336 void *conf)
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
337 {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
338 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
339
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
340 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
341
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
342 if (ecf->connections != NGX_CONF_UNSET) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
343 return "is duplicate" ;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
344 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
345
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
346 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
347 ecf->connections = ngx_atoi(value[1].data, value[1].len);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
348 if (ecf->connections == NGX_ERROR) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
349 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
350 "invalid number \"%s\"", value[1].data);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
351
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
352 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
353 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
354
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
355 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
356
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
357 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
358 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
359
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
360
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
361 static char *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
362 {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
363 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
364
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
365 int m;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
366 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
367 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
368 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
369
93
738fe44c70d5 nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 92
diff changeset
370 if (ecf->use != NGX_CONF_UNSET) {
738fe44c70d5 nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 92
diff changeset
371 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
372 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
373
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
374 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
375
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
376 if (cf->cycle->old_cycle) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
377 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
378 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
379 } else {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
380 old_ecf = NULL;
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
381 }
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
382
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
383 for (m = 0; ngx_modules[m]; m++) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
384 if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
385 continue;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
386 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
387
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
388 module = ngx_modules[m]->ctx;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
389 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
390 if (ngx_strcmp(module->name->data, value[1].data) == 0) {
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
391 ecf->use = ngx_modules[m]->ctx_index;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
392 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
393
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
394 if (old_ecf && old_ecf->use != ecf->use) {
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
395 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
396 "the \"%s\" event type must be the same as "
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
397 "in previous configuration - \"%s\" "
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
398 "and it can not be changed on the fly, "
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
399 "to change it you need to stop server "
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
400 "and start it again",
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
401 value[1].data, old_ecf->name);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
402 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
403 }
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
404
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
405 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
406 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
407 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
408 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
409
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
410 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
411 "invalid event type \"%s\"", value[1].data);
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
412
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
413 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
414 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
415
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
416
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
417 static void *ngx_event_create_conf(ngx_cycle_t *cycle)
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
418 {
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
419 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
420
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
421 ngx_test_null(ecf, ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t)),
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
422 NGX_CONF_ERROR);
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
423
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
424 ecf->connections = NGX_CONF_UNSET;
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
425 ecf->timer_queues = NGX_CONF_UNSET;
93
738fe44c70d5 nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 92
diff changeset
426 ecf->use = NGX_CONF_UNSET;
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
427 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
428
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
429 return ecf;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
430 }
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
431
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
432
114
ac69ab96328d nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 113
diff changeset
433 static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
434 {
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
435 ngx_event_conf_t *ecf = conf;
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
436
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
437 #if (HAVE_KQUEUE)
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
438
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
439 ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
440 ngx_conf_init_value(ecf->use, ngx_kqueue_module.ctx_index);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
441 ngx_conf_init_ptr_value(ecf->name, ngx_kqueue_module_ctx.name->data);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
442
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
443 #elif (HAVE_DEVPOLL)
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
444
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
445 ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
446 ngx_conf_init_value(ecf->use, ngx_devpoll_module.ctx_index);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
447 ngx_conf_init_ptr_value(ecf->name, ngx_devpoll_module_ctx.name->data);
92
19cc647ecd91 nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 91
diff changeset
448
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
449 #else /* HAVE_SELECT */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
450
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
451 ngx_conf_init_value(ecf->connections,
113
d7f606e25b99 nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 112
diff changeset
452 FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
453
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 93
diff changeset
454 ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index);
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
455 ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data);
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
456
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
457 #endif
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
458
209
e1c815be05ae nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 205
diff changeset
459 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
460
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
461 ngx_conf_init_value(ecf->timer_queues, 10);
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
462
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
463 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
464 }