Mercurial > hg > nginx
annotate src/event/ngx_event_accept.c @ 2570:62131e628135
bump version
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 16 Mar 2009 11:07:29 +0000 |
parents | 2e91aecb9e57 |
children | 53be1d485af9 |
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:
431
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:
431
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
431
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
431
diff
changeset
|
5 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
6 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
7 #include <ngx_config.h> |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
8 #include <ngx_core.h> |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
9 #include <ngx_event.h> |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
573 | 12 static ngx_int_t ngx_enable_accept_events(ngx_cycle_t *cycle); |
13 static ngx_int_t ngx_disable_accept_events(ngx_cycle_t *cycle); | |
543 | 14 static void ngx_close_accepted_connection(ngx_connection_t *c); |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
15 |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
16 |
493 | 17 void |
18 ngx_event_accept(ngx_event_t *ev) | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 { |
714 | 20 socklen_t socklen; |
483 | 21 ngx_err_t err; |
22 ngx_log_t *log; | |
23 ngx_socket_t s; | |
24 ngx_event_t *rev, *wev; | |
543 | 25 ngx_listening_t *ls; |
26 ngx_connection_t *c, *lc; | |
483 | 27 ngx_event_conf_t *ecf; |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
28 u_char sa[NGX_SOCKADDRLEN]; |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
29 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
30 ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module); |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
31 |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
32 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
33 ev->available = 1; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
34 |
455 | 35 } else if (!(ngx_event_flags & NGX_USE_KQUEUE_EVENT)) { |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
36 ev->available = ecf->multi_accept; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
37 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
38 |
543 | 39 lc = ev->data; |
40 ls = lc->listening; | |
41 ev->ready = 0; | |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
42 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
43 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
543 | 44 "accept on %V, ready: %d", &ls->addr_text, ev->available); |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
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 do { |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
47 socklen = NGX_SOCKADDRLEN; |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
48 |
714 | 49 s = accept(lc->fd, (struct sockaddr *) sa, &socklen); |
477 | 50 |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
51 if (s == -1) { |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
52 err = ngx_socket_errno; |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
53 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
54 if (err == NGX_EAGAIN) { |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
55 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, err, |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
56 "accept() not ready"); |
87
5f6d848dcbef
nginx-0.0.1-2003-05-13-20:02:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
57 return; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
58 } |
6
669801705ab1
nginx-0.0.1-2002-08-26-19:18:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
59 |
617 | 60 ngx_log_error((err == NGX_ECONNABORTED) ? NGX_LOG_ERR: |
509 | 61 NGX_LOG_ALERT, |
543 | 62 ev->log, err, "accept() failed"); |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
63 |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
64 if (err == NGX_ECONNABORTED) { |
455 | 65 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
66 ev->available--; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
67 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
68 |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
69 if (ev->available) { |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
70 continue; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
71 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
72 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
73 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
74 return; |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
75 } |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
76 |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
77 #if (NGX_STAT_STUB) |
561 | 78 ngx_atomic_fetch_add(ngx_stat_accepted, 1); |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
79 #endif |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
80 |
2255 | 81 ngx_accept_disabled = ngx_cycle->connection_n / 8 |
543 | 82 - ngx_cycle->free_connection_n; |
83 | |
84 c = ngx_get_connection(s, ev->log); | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
85 |
543 | 86 if (c == NULL) { |
87 if (ngx_close_socket(s) == -1) { | |
88 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | |
89 ngx_close_socket_n " failed"); | |
90 } | |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
91 |
543 | 92 return; |
93 } | |
94 | |
635 | 95 #if (NGX_STAT_STUB) |
96 ngx_atomic_fetch_add(ngx_stat_active, 1); | |
97 #endif | |
98 | |
543 | 99 c->pool = ngx_create_pool(ls->pool_size, ev->log); |
100 if (c->pool == NULL) { | |
101 ngx_close_accepted_connection(c); | |
102 return; | |
103 } | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
104 |
714 | 105 c->sockaddr = ngx_palloc(c->pool, socklen); |
543 | 106 if (c->sockaddr == NULL) { |
107 ngx_close_accepted_connection(c); | |
108 return; | |
109 } | |
110 | |
714 | 111 ngx_memcpy(c->sockaddr, sa, socklen); |
543 | 112 |
113 log = ngx_palloc(c->pool, sizeof(ngx_log_t)); | |
114 if (log == NULL) { | |
115 ngx_close_accepted_connection(c); | |
87
5f6d848dcbef
nginx-0.0.1-2003-05-13-20:02:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
116 return; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
117 } |
6
669801705ab1
nginx-0.0.1-2002-08-26-19:18:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
118 |
487 | 119 /* set a blocking mode for aio and non-blocking mode for others */ |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
120 |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
121 if (ngx_inherited_nonblocking) { |
543 | 122 if (ngx_event_flags & NGX_USE_AIO_EVENT) { |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
123 if (ngx_blocking(s) == -1) { |
543 | 124 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
125 ngx_blocking_n " failed"); |
543 | 126 ngx_close_accepted_connection(c); |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
127 return; |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
128 } |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
129 } |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
130 |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
131 } else { |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
132 if (!(ngx_event_flags & (NGX_USE_AIO_EVENT|NGX_USE_RTSIG_EVENT))) { |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
133 if (ngx_nonblocking(s) == -1) { |
543 | 134 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
135 ngx_nonblocking_n " failed"); |
543 | 136 ngx_close_accepted_connection(c); |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
137 return; |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
138 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
139 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
140 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
141 |
543 | 142 *log = ls->log; |
143 | |
144 c->recv = ngx_recv; | |
145 c->send = ngx_send; | |
577 | 146 c->recv_chain = ngx_recv_chain; |
543 | 147 c->send_chain = ngx_send_chain; |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
148 |
543 | 149 c->log = log; |
150 c->pool->log = log; | |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
151 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
152 c->socklen = socklen; |
543 | 153 c->listening = ls; |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
154 c->local_sockaddr = ls->sockaddr; |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
155 c->local_socklen = ls->socklen; |
543 | 156 |
157 c->unexpected_eof = 1; | |
158 | |
561 | 159 rev = c->read; |
160 wev = c->write; | |
86
3973260705cc
nginx-0.0.1-2003-05-12-19:52:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
161 |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
121
diff
changeset
|
162 wev->ready = 1; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
163 |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
164 if (ngx_event_flags & (NGX_USE_AIO_EVENT|NGX_USE_RTSIG_EVENT)) { |
493 | 165 /* rtsig, aio, iocp */ |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
121
diff
changeset
|
166 rev->ready = 1; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
167 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
168 |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
169 if (ev->deferred_accept) { |
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
170 rev->ready = 1; |
523 | 171 #if (NGX_HAVE_KQUEUE) |
172 rev->available = 1; | |
173 #endif | |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
174 } |
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
175 |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
176 rev->log = log; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
177 wev->log = log; |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
178 |
208
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
206
diff
changeset
|
179 /* |
561 | 180 * TODO: MT: - ngx_atomic_fetch_add() |
266
5238e93961a1
nginx-0.0.2-2004-02-23-23:57:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
260
diff
changeset
|
181 * or protection by critical section or light mutex |
208
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
206
diff
changeset
|
182 * |
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
206
diff
changeset
|
183 * TODO: MP: - allocated in a shared memory |
561 | 184 * - ngx_atomic_fetch_add() |
266
5238e93961a1
nginx-0.0.2-2004-02-23-23:57:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
260
diff
changeset
|
185 * or protection by critical section or light mutex |
208
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
206
diff
changeset
|
186 */ |
212
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
187 |
561 | 188 c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1); |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
189 |
495 | 190 #if (NGX_STAT_STUB) |
561 | 191 ngx_atomic_fetch_add(ngx_stat_handled, 1); |
495 | 192 #endif |
193 | |
370
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
194 #if (NGX_THREADS) |
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
195 rev->lock = &c->lock; |
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
196 wev->lock = &c->lock; |
380
5ce6561246a5
nginx-0.0.7-2004-07-07-10:15:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
197 rev->own_lock = &c->lock; |
5ce6561246a5
nginx-0.0.7-2004-07-07-10:15:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
198 wev->own_lock = &c->lock; |
370
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
199 #endif |
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
200 |
543 | 201 if (ls->addr_ntop) { |
2049 | 202 c->addr_text.data = ngx_pnalloc(c->pool, ls->addr_text_max_len); |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
203 if (c->addr_text.data == NULL) { |
543 | 204 ngx_close_accepted_connection(c); |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
205 return; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
206 } |
577 | 207 |
2198
5975975eedc0
ngx_sock_ntop() takes family from sockaddr, remove duplicate field
Igor Sysoev <igor@sysoev.ru>
parents:
2049
diff
changeset
|
208 c->addr_text.len = ngx_sock_ntop(c->sockaddr, c->addr_text.data, |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
209 ls->addr_text_max_len, 0); |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
210 if (c->addr_text.len == 0) { |
543 | 211 ngx_close_accepted_connection(c); |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
212 return; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
213 } |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
214 } |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
215 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
216 #if (NGX_DEBUG) |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
217 { |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
218 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
219 in_addr_t i; |
665 | 220 ngx_event_debug_t *dc; |
479 | 221 struct sockaddr_in *sin; |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
222 |
479 | 223 sin = (struct sockaddr_in *) sa; |
665 | 224 dc = ecf->debug_connection.elts; |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
225 for (i = 0; i < ecf->debug_connection.nelts; i++) { |
665 | 226 if ((sin->sin_addr.s_addr & dc[i].mask) == dc[i].addr) { |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
227 log->log_level = NGX_LOG_DEBUG_CONNECTION|NGX_LOG_DEBUG_ALL; |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
228 break; |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
229 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
230 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
231 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
232 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
233 #endif |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
234 |
665 | 235 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, |
236 "*%d accept: %V fd:%d", c->number, &c->addr_text, s); | |
237 | |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
238 if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) { |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
239 if (ngx_add_conn(c) == NGX_ERROR) { |
543 | 240 ngx_close_accepted_connection(c); |
87
5f6d848dcbef
nginx-0.0.1-2003-05-13-20:02:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
86
diff
changeset
|
241 return; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
242 } |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
243 } |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
244 |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
245 log->data = NULL; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
246 log->handler = NULL; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
247 |
543 | 248 ls->handler(c); |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
249 |
455 | 250 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
251 ev->available--; |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
252 } |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
253 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
254 } while (ev->available); |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
255 } |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
256 |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
257 |
493 | 258 ngx_int_t |
259 ngx_trylock_accept_mutex(ngx_cycle_t *cycle) | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
260 { |
611 | 261 if (ngx_shmtx_trylock(&ngx_accept_mutex)) { |
262 | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
263 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
264 "accept mutex locked"); |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
265 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
266 if (ngx_accept_mutex_held |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
267 && ngx_accept_events == 0 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
268 && !(ngx_event_flags & NGX_USE_RTSIG_EVENT)) |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
269 { |
573 | 270 return NGX_OK; |
271 } | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
272 |
573 | 273 if (ngx_enable_accept_events(cycle) == NGX_ERROR) { |
611 | 274 ngx_shmtx_unlock(&ngx_accept_mutex); |
573 | 275 return NGX_ERROR; |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
276 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
277 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
278 ngx_accept_events = 0; |
573 | 279 ngx_accept_mutex_held = 1; |
280 | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
281 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
282 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
283 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
284 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
285 "accept mutex lock failed: %ui", ngx_accept_mutex_held); |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
286 |
302
1526e7686b20
nginx-0.0.3-2004-04-01-10:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
287 if (ngx_accept_mutex_held) { |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
288 if (ngx_disable_accept_events(cycle) == NGX_ERROR) { |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
289 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
290 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
291 |
302
1526e7686b20
nginx-0.0.3-2004-04-01-10:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
292 ngx_accept_mutex_held = 0; |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
293 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
294 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
295 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
296 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
297 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
298 |
573 | 299 static ngx_int_t |
493 | 300 ngx_enable_accept_events(ngx_cycle_t *cycle) |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
301 { |
543 | 302 ngx_uint_t i; |
303 ngx_listening_t *ls; | |
304 ngx_connection_t *c; | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
305 |
543 | 306 ls = cycle->listening.elts; |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
307 for (i = 0; i < cycle->listening.nelts; i++) { |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
308 |
543 | 309 c = ls[i].connection; |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
310 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
311 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { |
573 | 312 |
543 | 313 if (ngx_add_conn(c) == NGX_ERROR) { |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
314 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
315 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
316 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
317 } else { |
543 | 318 if (ngx_add_event(c->read, NGX_READ_EVENT, 0) == NGX_ERROR) { |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
319 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
320 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
321 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
322 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
323 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
324 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
325 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
326 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
327 |
573 | 328 static ngx_int_t |
493 | 329 ngx_disable_accept_events(ngx_cycle_t *cycle) |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
330 { |
543 | 331 ngx_uint_t i; |
332 ngx_listening_t *ls; | |
333 ngx_connection_t *c; | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
334 |
543 | 335 ls = cycle->listening.elts; |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
336 for (i = 0; i < cycle->listening.nelts; i++) { |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
337 |
543 | 338 c = ls[i].connection; |
339 | |
340 if (!c->read->active) { | |
341 continue; | |
342 } | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
343 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
344 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { |
543 | 345 if (ngx_del_conn(c, NGX_DISABLE_EVENT) == NGX_ERROR) { |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
346 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
347 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
348 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
349 } else { |
543 | 350 if (ngx_del_event(c->read, NGX_READ_EVENT, NGX_DISABLE_EVENT) |
351 == NGX_ERROR) | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
352 { |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
353 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
354 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
355 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
356 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
357 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
358 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
359 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
360 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
361 |
493 | 362 static void |
543 | 363 ngx_close_accepted_connection(ngx_connection_t *c) |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
364 { |
543 | 365 ngx_socket_t fd; |
366 | |
367 ngx_free_connection(c); | |
368 | |
369 fd = c->fd; | |
370 c->fd = (ngx_socket_t) -1; | |
371 | |
372 if (ngx_close_socket(fd) == -1) { | |
373 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
374 ngx_close_socket_n " failed"); |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
375 } |
495 | 376 |
543 | 377 if (c->pool) { |
378 ngx_destroy_pool(c->pool); | |
379 } | |
380 | |
495 | 381 #if (NGX_STAT_STUB) |
561 | 382 ngx_atomic_fetch_add(ngx_stat_active, -1); |
495 | 383 #endif |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
384 } |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
385 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
386 |
543 | 387 u_char * |
493 | 388 ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len) |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
389 { |
543 | 390 return ngx_snprintf(buf, len, " while accepting new connection on %V", |
391 log->data); | |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
392 } |