Mercurial > hg > nginx-quic
annotate src/event/ngx_event_accept.c @ 5142:afea5259e05c
Upstream: fixed tcp_nodelay with connection upgrade (ticket #325).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 27 Mar 2013 15:18:34 +0000 |
parents | c05cfc46b3bc |
children | 05ba5bce31e0 |
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 |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
431
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
431
diff
changeset
|
6 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
7 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
8 #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
|
9 #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
|
10 #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
|
11 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
573 | 13 static ngx_int_t ngx_enable_accept_events(ngx_cycle_t *cycle); |
14 static ngx_int_t ngx_disable_accept_events(ngx_cycle_t *cycle); | |
543 | 15 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
|
16 |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
17 |
493 | 18 void |
19 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
|
20 { |
714 | 21 socklen_t socklen; |
483 | 22 ngx_err_t err; |
23 ngx_log_t *log; | |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
24 ngx_uint_t level; |
483 | 25 ngx_socket_t s; |
26 ngx_event_t *rev, *wev; | |
543 | 27 ngx_listening_t *ls; |
28 ngx_connection_t *c, *lc; | |
483 | 29 ngx_event_conf_t *ecf; |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
30 u_char sa[NGX_SOCKADDRLEN]; |
3812
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
31 #if (NGX_HAVE_ACCEPT4) |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
32 static ngx_uint_t use_accept4 = 1; |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
33 #endif |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
34 |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
35 if (ev->timedout) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
36 if (ngx_enable_accept_events((ngx_cycle_t *) ngx_cycle) != NGX_OK) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
37 return; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
38 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
39 |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
40 ev->timedout = 0; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
41 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
42 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
43 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
|
44 |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
45 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
|
46 ev->available = 1; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
47 |
455 | 48 } 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
|
49 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
|
50 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
51 |
543 | 52 lc = ev->data; |
53 ls = lc->listening; | |
54 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
|
55 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
56 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
543 | 57 "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
|
58 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
59 do { |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
60 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
|
61 |
3786 | 62 #if (NGX_HAVE_ACCEPT4) |
3812
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
63 if (use_accept4) { |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
64 s = accept4(lc->fd, (struct sockaddr *) sa, &socklen, |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
65 SOCK_NONBLOCK); |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
66 } else { |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
67 s = accept(lc->fd, (struct sockaddr *) sa, &socklen); |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
68 } |
3786 | 69 #else |
714 | 70 s = accept(lc->fd, (struct sockaddr *) sa, &socklen); |
3786 | 71 #endif |
477 | 72 |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
73 if (s == -1) { |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
74 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
|
75 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
76 if (err == NGX_EAGAIN) { |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
77 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
|
78 "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
|
79 return; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
80 } |
6
669801705ab1
nginx-0.0.1-2002-08-26-19:18:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
81 |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
82 level = NGX_LOG_ALERT; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
83 |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
84 if (err == NGX_ECONNABORTED) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
85 level = NGX_LOG_ERR; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
86 |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
87 } else if (err == NGX_EMFILE || err == NGX_ENFILE) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
88 level = NGX_LOG_CRIT; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
89 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
90 |
3813
c870fb78550c
fix building by msvc8 introduced by the previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
3812
diff
changeset
|
91 #if (NGX_HAVE_ACCEPT4) |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
92 ngx_log_error(level, ev->log, err, |
3812
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
93 use_accept4 ? "accept4() failed" : "accept() failed"); |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
94 |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
95 if (use_accept4 && err == NGX_ENOSYS) { |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
96 use_accept4 = 0; |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
97 ngx_inherited_nonblocking = 0; |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
98 continue; |
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
99 } |
3813
c870fb78550c
fix building by msvc8 introduced by the previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
3812
diff
changeset
|
100 #else |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
101 ngx_log_error(level, ev->log, err, "accept() failed"); |
3812
ef27dc1a7832
fallback to accept() if accept4() is not implemented,
Igor Sysoev <igor@sysoev.ru>
parents:
3786
diff
changeset
|
102 #endif |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
103 |
248
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
104 if (err == NGX_ECONNABORTED) { |
455 | 105 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
|
106 ev->available--; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
107 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
108 |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
109 if (ev->available) { |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
110 continue; |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
111 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
112 } |
e885208c518b
nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
113 |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
114 if (err == NGX_EMFILE || err == NGX_ENFILE) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
115 if (ngx_disable_accept_events((ngx_cycle_t *) ngx_cycle) |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
116 != NGX_OK) |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
117 { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
118 return; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
119 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
120 |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
121 if (ngx_use_accept_mutex) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
122 if (ngx_accept_mutex_held) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
123 ngx_shmtx_unlock(&ngx_accept_mutex); |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
124 ngx_accept_mutex_held = 0; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
125 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
126 |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
127 ngx_accept_disabled = 1; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
128 |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
129 } else { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
130 ngx_add_timer(ev, ecf->accept_mutex_delay); |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
131 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
132 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
133 |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
134 return; |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
135 } |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
136 |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
137 #if (NGX_STAT_STUB) |
2951
5acd98486a33
ignore ngx_atomic_fetch_add() result
Igor Sysoev <igor@sysoev.ru>
parents:
2723
diff
changeset
|
138 (void) 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
|
139 #endif |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
140 |
2255 | 141 ngx_accept_disabled = ngx_cycle->connection_n / 8 |
543 | 142 - ngx_cycle->free_connection_n; |
143 | |
144 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
|
145 |
543 | 146 if (c == NULL) { |
147 if (ngx_close_socket(s) == -1) { | |
148 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | |
149 ngx_close_socket_n " failed"); | |
150 } | |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
151 |
543 | 152 return; |
153 } | |
154 | |
635 | 155 #if (NGX_STAT_STUB) |
2951
5acd98486a33
ignore ngx_atomic_fetch_add() result
Igor Sysoev <igor@sysoev.ru>
parents:
2723
diff
changeset
|
156 (void) ngx_atomic_fetch_add(ngx_stat_active, 1); |
635 | 157 #endif |
158 | |
543 | 159 c->pool = ngx_create_pool(ls->pool_size, ev->log); |
160 if (c->pool == NULL) { | |
161 ngx_close_accepted_connection(c); | |
162 return; | |
163 } | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
164 |
714 | 165 c->sockaddr = ngx_palloc(c->pool, socklen); |
543 | 166 if (c->sockaddr == NULL) { |
167 ngx_close_accepted_connection(c); | |
168 return; | |
169 } | |
170 | |
714 | 171 ngx_memcpy(c->sockaddr, sa, socklen); |
543 | 172 |
173 log = ngx_palloc(c->pool, sizeof(ngx_log_t)); | |
174 if (log == NULL) { | |
175 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
|
176 return; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
177 } |
6
669801705ab1
nginx-0.0.1-2002-08-26-19:18:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
178 |
487 | 179 /* 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
|
180 |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
181 if (ngx_inherited_nonblocking) { |
543 | 182 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
|
183 if (ngx_blocking(s) == -1) { |
543 | 184 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
|
185 ngx_blocking_n " failed"); |
543 | 186 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
|
187 return; |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
188 } |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
189 } |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
190 |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
191 } else { |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
192 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
|
193 if (ngx_nonblocking(s) == -1) { |
543 | 194 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
|
195 ngx_nonblocking_n " failed"); |
543 | 196 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
|
197 return; |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
198 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
199 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
200 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
201 |
543 | 202 *log = ls->log; |
203 | |
204 c->recv = ngx_recv; | |
205 c->send = ngx_send; | |
577 | 206 c->recv_chain = ngx_recv_chain; |
543 | 207 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
|
208 |
543 | 209 c->log = log; |
210 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
|
211 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
212 c->socklen = socklen; |
543 | 213 c->listening = ls; |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
214 c->local_sockaddr = ls->sockaddr; |
543 | 215 |
216 c->unexpected_eof = 1; | |
217 | |
3230
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
218 #if (NGX_HAVE_UNIX_DOMAIN) |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
219 if (c->sockaddr->sa_family == AF_UNIX) { |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
220 c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
221 c->tcp_nodelay = NGX_TCP_NODELAY_DISABLED; |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
222 #if (NGX_SOLARIS) |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
223 /* Solaris's sendfilev() supports AF_NCA, AF_INET, and AF_INET6 */ |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
224 c->sendfile = 0; |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
225 #endif |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
226 } |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
227 #endif |
a7491af45540
http listen unix domain sockets
Igor Sysoev <igor@sysoev.ru>
parents:
2951
diff
changeset
|
228 |
561 | 229 rev = c->read; |
230 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
|
231 |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
121
diff
changeset
|
232 wev->ready = 1; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
233 |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
234 if (ngx_event_flags & (NGX_USE_AIO_EVENT|NGX_USE_RTSIG_EVENT)) { |
493 | 235 /* 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
|
236 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
|
237 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
238 |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
239 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
|
240 rev->ready = 1; |
523 | 241 #if (NGX_HAVE_KQUEUE) |
242 rev->available = 1; | |
243 #endif | |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
244 } |
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
236
diff
changeset
|
245 |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
246 rev->log = log; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
247 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
|
248 |
208
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
206
diff
changeset
|
249 /* |
561 | 250 * 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
|
251 * 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
|
252 * |
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
206
diff
changeset
|
253 * TODO: MP: - allocated in a shared memory |
561 | 254 * - 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
|
255 * 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
|
256 */ |
212
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
257 |
561 | 258 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
|
259 |
495 | 260 #if (NGX_STAT_STUB) |
2951
5acd98486a33
ignore ngx_atomic_fetch_add() result
Igor Sysoev <igor@sysoev.ru>
parents:
2723
diff
changeset
|
261 (void) ngx_atomic_fetch_add(ngx_stat_handled, 1); |
495 | 262 #endif |
263 | |
370
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
264 #if (NGX_THREADS) |
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 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
|
269 #endif |
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
350
diff
changeset
|
270 |
543 | 271 if (ls->addr_ntop) { |
2049 | 272 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
|
273 if (c->addr_text.data == NULL) { |
543 | 274 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
|
275 return; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
276 } |
577 | 277 |
2198
5975975eedc0
ngx_sock_ntop() takes family from sockaddr, remove duplicate field
Igor Sysoev <igor@sysoev.ru>
parents:
2049
diff
changeset
|
278 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
|
279 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
|
280 if (c->addr_text.len == 0) { |
543 | 281 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
|
282 return; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
283 } |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
284 } |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
285 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
286 #if (NGX_DEBUG) |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
287 { |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
288 |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
289 struct sockaddr_in *sin; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
290 ngx_cidr_t *cidr; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
291 ngx_uint_t i; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
292 #if (NGX_HAVE_INET6) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
293 struct sockaddr_in6 *sin6; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
294 ngx_uint_t n; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
295 #endif |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
296 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
297 cidr = ecf->debug_connection.elts; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
298 for (i = 0; i < ecf->debug_connection.nelts; i++) { |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
299 if (cidr[i].family != c->sockaddr->sa_family) { |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
300 goto next; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
301 } |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
302 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
303 switch (cidr[i].family) { |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
304 |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
305 #if (NGX_HAVE_INET6) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
306 case AF_INET6: |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
307 sin6 = (struct sockaddr_in6 *) c->sockaddr; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
308 for (n = 0; n < 16; n++) { |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
309 if ((sin6->sin6_addr.s6_addr[n] |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
310 & cidr[i].u.in6.mask.s6_addr[n]) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
311 != cidr[i].u.in6.addr.s6_addr[n]) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
312 { |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
313 goto next; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
314 } |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
315 } |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
316 break; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
317 #endif |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
318 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
319 #if (NGX_HAVE_UNIX_DOMAIN) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
320 case AF_UNIX: |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
321 break; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
322 #endif |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
323 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
324 default: /* AF_INET */ |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
325 sin = (struct sockaddr_in *) c->sockaddr; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
326 if ((sin->sin_addr.s_addr & cidr[i].u.in.mask) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
327 != cidr[i].u.in.addr) |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
328 { |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
329 goto next; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
330 } |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
331 break; |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
332 } |
4613
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
333 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
334 log->log_level = NGX_LOG_DEBUG_CONNECTION|NGX_LOG_DEBUG_ALL; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
335 break; |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
336 |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
337 next: |
9ee20e074a2e
debug_connection: added the IPv6 and UNIX-domain socket support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
338 continue; |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
339 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
340 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
341 } |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
342 #endif |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
343 |
665 | 344 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, |
345 "*%d accept: %V fd:%d", c->number, &c->addr_text, s); | |
346 | |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
347 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
|
348 if (ngx_add_conn(c) == NGX_ERROR) { |
543 | 349 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
|
350 return; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
351 } |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
352 } |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
63
diff
changeset
|
353 |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
354 log->data = NULL; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
355 log->handler = NULL; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
356 |
543 | 357 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
|
358 |
455 | 359 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
|
360 ev->available--; |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
361 } |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
362 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
363 } while (ev->available); |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
364 } |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
365 |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
366 |
493 | 367 ngx_int_t |
368 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
|
369 { |
611 | 370 if (ngx_shmtx_trylock(&ngx_accept_mutex)) { |
371 | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
372 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
|
373 "accept mutex locked"); |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
374 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
375 if (ngx_accept_mutex_held |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
376 && ngx_accept_events == 0 |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
377 && !(ngx_event_flags & NGX_USE_RTSIG_EVENT)) |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
378 { |
573 | 379 return NGX_OK; |
380 } | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
381 |
573 | 382 if (ngx_enable_accept_events(cycle) == NGX_ERROR) { |
611 | 383 ngx_shmtx_unlock(&ngx_accept_mutex); |
573 | 384 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
|
385 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
386 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
387 ngx_accept_events = 0; |
573 | 388 ngx_accept_mutex_held = 1; |
389 | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
390 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
391 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
392 |
719
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
393 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
|
394 "accept mutex lock failed: %ui", ngx_accept_mutex_held); |
f30b1a75fd3b
Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents:
714
diff
changeset
|
395 |
302
1526e7686b20
nginx-0.0.3-2004-04-01-10:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
396 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
|
397 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
|
398 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
399 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
400 |
302
1526e7686b20
nginx-0.0.3-2004-04-01-10:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
301
diff
changeset
|
401 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
|
402 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
403 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
404 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
405 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
406 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
407 |
573 | 408 static ngx_int_t |
493 | 409 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
|
410 { |
543 | 411 ngx_uint_t i; |
412 ngx_listening_t *ls; | |
413 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
|
414 |
543 | 415 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
|
416 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
|
417 |
543 | 418 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
|
419 |
4618
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
420 if (c->read->active) { |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
421 continue; |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
422 } |
c05cfc46b3bc
Accept moderation in case of EMFILE/ENFILE.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4613
diff
changeset
|
423 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
424 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { |
573 | 425 |
543 | 426 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
|
427 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
428 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
429 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
430 } else { |
543 | 431 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
|
432 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
433 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
434 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
435 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
436 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
437 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
438 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
439 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
440 |
573 | 441 static ngx_int_t |
493 | 442 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
|
443 { |
543 | 444 ngx_uint_t i; |
445 ngx_listening_t *ls; | |
446 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
|
447 |
543 | 448 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
|
449 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
|
450 |
543 | 451 c = ls[i].connection; |
452 | |
453 if (!c->read->active) { | |
454 continue; | |
455 } | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
456 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
457 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { |
543 | 458 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
|
459 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
460 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
461 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
462 } else { |
543 | 463 if (ngx_del_event(c->read, NGX_READ_EVENT, NGX_DISABLE_EVENT) |
464 == NGX_ERROR) | |
301
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
465 { |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
466 return NGX_ERROR; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
467 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
468 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
469 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
470 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
471 return NGX_OK; |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
472 } |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
473 |
744965ec6275
nginx-0.0.3-2004-03-31-19:26:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
474 |
493 | 475 static void |
543 | 476 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
|
477 { |
543 | 478 ngx_socket_t fd; |
479 | |
480 ngx_free_connection(c); | |
481 | |
482 fd = c->fd; | |
483 c->fd = (ngx_socket_t) -1; | |
484 | |
485 if (ngx_close_socket(fd) == -1) { | |
486 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
|
487 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
|
488 } |
495 | 489 |
543 | 490 if (c->pool) { |
491 ngx_destroy_pool(c->pool); | |
492 } | |
493 | |
495 | 494 #if (NGX_STAT_STUB) |
2951
5acd98486a33
ignore ngx_atomic_fetch_add() result
Igor Sysoev <igor@sysoev.ru>
parents:
2723
diff
changeset
|
495 (void) ngx_atomic_fetch_add(ngx_stat_active, -1); |
495 | 496 #endif |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
497 } |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
498 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
499 |
543 | 500 u_char * |
493 | 501 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
|
502 { |
543 | 503 return ngx_snprintf(buf, len, " while accepting new connection on %V", |
504 log->data); | |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
505 } |