Mercurial > hg > nginx-quic
annotate src/event/ngx_event_acceptex.c @ 5920:7420068c4d4b
Resolver: fixed use-after-free memory access.
In 954867a2f0a6, we switched to using resolver node as the
timer event data, so make sure we do not free resolver node
memory until the corresponding timer is deleted.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 20 Nov 2014 15:24:40 +0300 |
parents | 1ab1cf63f885 |
children | 293413010217 |
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:
343
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:
343
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:
343
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:
343
diff
changeset
|
6 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
9 #include <ngx_core.h> |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <ngx_event.h> |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
543 | 13 static void ngx_close_posted_connection(ngx_connection_t *c); |
14 | |
15 | |
16 void | |
17 ngx_event_acceptex(ngx_event_t *rev) | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
18 { |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
19 ngx_listening_t *ls; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 ngx_connection_t *c; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 |
461 | 22 c = rev->data; |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
23 ls = c->listening; |
461 | 24 |
543 | 25 c->log->handler = ngx_accept_log_error; |
26 | |
461 | 27 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "AcceptEx: %d", c->fd); |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
28 |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
29 if (rev->ovlp.error) { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
30 ngx_log_error(NGX_LOG_CRIT, c->log, rev->ovlp.error, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
31 "AcceptEx() %V failed", &ls->addr_text); |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
32 return; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
35 /* SO_UPDATE_ACCEPT_CONTEXT is required for shutdown() to work */ |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
36 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
37 if (setsockopt(c->fd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
38 (char *) &ls->fd, sizeof(ngx_socket_t)) |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
39 == -1) |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
40 { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
41 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, |
461 | 42 "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed for %V", |
43 &c->addr_text); | |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
44 } else { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
45 c->accept_context_updated = 1; |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
46 } |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
47 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
48 ngx_getacceptexsockaddrs(c->buffer->pos, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
49 ls->post_accept_buffer_size, |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
50 ls->socklen + 16, |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
51 ls->socklen + 16, |
5463
1ab1cf63f885
Core: keep the length of the local sockaddr.
Ruslan Ermilov <ru@nginx.com>
parents:
5360
diff
changeset
|
52 &c->local_sockaddr, &c->local_socklen, |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
53 &c->sockaddr, &c->socklen); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
54 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
55 if (ls->post_accept_buffer_size) { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
56 c->buffer->last += rev->available; |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
57 c->buffer->end = c->buffer->start + ls->post_accept_buffer_size; |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
58 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
59 } else { |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
60 c->buffer = NULL; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
61 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
62 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
63 if (ls->addr_ntop) { |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
64 c->addr_text.data = ngx_pnalloc(c->pool, ls->addr_text_max_len); |
461 | 65 if (c->addr_text.data == NULL) { |
66 /* TODO: close socket */ | |
67 return; | |
68 } | |
69 | |
5263
05ba5bce31e0
Core: extended ngx_sock_ntop() with socklen parameter.
Vladimir Homutov <vl@nginx.com>
parents:
4412
diff
changeset
|
70 c->addr_text.len = ngx_sock_ntop(c->sockaddr, c->socklen, |
05ba5bce31e0
Core: extended ngx_sock_ntop() with socklen parameter.
Vladimir Homutov <vl@nginx.com>
parents:
4412
diff
changeset
|
71 c->addr_text.data, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
72 ls->addr_text_max_len, 0); |
461 | 73 if (c->addr_text.len == 0) { |
74 /* TODO: close socket */ | |
75 return; | |
76 } | |
77 } | |
78 | |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
79 ngx_event_post_acceptex(ls, 1); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
80 |
561 | 81 c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
82 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
83 ls->handler(c); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
84 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
85 return; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
86 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
87 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
88 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
89 |
543 | 90 ngx_int_t |
91 ngx_event_post_acceptex(ngx_listening_t *ls, ngx_uint_t n) | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
92 { |
280
7c7183b3ea8b
nginx-0.0.2-2004-03-05-11:34:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
93 u_long rcvd; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
94 ngx_err_t err; |
543 | 95 ngx_log_t *log; |
96 ngx_uint_t i; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
97 ngx_event_t *rev, *wev; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
98 ngx_socket_t s; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
99 ngx_connection_t *c; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 for (i = 0; i < n; i++) { |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
103 /* TODO: look up reused sockets */ |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
104 |
2198
5975975eedc0
ngx_sock_ntop() takes family from sockaddr, remove duplicate field
Igor Sysoev <igor@sysoev.ru>
parents:
2049
diff
changeset
|
105 s = ngx_socket(ls->sockaddr->sa_family, ls->type, 0); |
278
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
106 |
543 | 107 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &ls->log, 0, |
461 | 108 ngx_socket_n " s:%d", s); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
109 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5263
diff
changeset
|
110 if (s == (ngx_socket_t) -1) { |
543 | 111 ngx_log_error(NGX_LOG_ALERT, &ls->log, ngx_socket_errno, |
112 ngx_socket_n " failed"); | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
114 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
115 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
116 |
543 | 117 c = ngx_get_connection(s, &ls->log); |
118 | |
119 if (c == NULL) { | |
120 return NGX_ERROR; | |
121 } | |
122 | |
123 c->pool = ngx_create_pool(ls->pool_size, &ls->log); | |
124 if (c->pool == NULL) { | |
125 ngx_close_posted_connection(c); | |
126 return NGX_ERROR; | |
127 } | |
128 | |
129 log = ngx_palloc(c->pool, sizeof(ngx_log_t)); | |
130 if (log == NULL) { | |
131 ngx_close_posted_connection(c); | |
132 return NGX_ERROR; | |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
133 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
134 |
543 | 135 c->buffer = ngx_create_temp_buf(c->pool, ls->post_accept_buffer_size |
136 + 2 * (ls->socklen + 16)); | |
137 if (c->buffer == NULL) { | |
138 ngx_close_posted_connection(c); | |
139 return NGX_ERROR; | |
140 } | |
141 | |
142 c->local_sockaddr = ngx_palloc(c->pool, ls->socklen); | |
143 if (c->local_sockaddr == NULL) { | |
144 ngx_close_posted_connection(c); | |
145 return NGX_ERROR; | |
146 } | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
147 |
543 | 148 c->sockaddr = ngx_palloc(c->pool, ls->socklen); |
149 if (c->sockaddr == NULL) { | |
150 ngx_close_posted_connection(c); | |
151 return NGX_ERROR; | |
152 } | |
153 | |
154 *log = ls->log; | |
155 c->log = log; | |
156 | |
157 c->recv = ngx_recv; | |
158 c->send = ngx_send; | |
577 | 159 c->recv_chain = ngx_recv_chain; |
543 | 160 c->send_chain = ngx_send_chain; |
161 | |
162 c->unexpected_eof = 1; | |
163 | |
164 c->listening = ls; | |
165 | |
561 | 166 rev = c->read; |
167 wev = c->write; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
168 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 rev->ovlp.event = rev; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
170 wev->ovlp.event = wev; |
509 | 171 rev->handler = ngx_event_acceptex; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
172 |
461 | 173 rev->ready = 1; |
174 wev->ready = 1; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
175 |
543 | 176 rev->log = c->log; |
177 wev->log = c->log; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
178 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
179 if (ngx_add_event(rev, 0, NGX_IOCP_IO) == NGX_ERROR) { |
543 | 180 ngx_close_posted_connection(c); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
182 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
184 if (ngx_acceptex(ls->fd, s, c->buffer->pos, ls->post_accept_buffer_size, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
185 ls->socklen + 16, ls->socklen + 16, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
186 &rcvd, (LPOVERLAPPED) &rev->ovlp) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
187 == 0) |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
188 { |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
189 err = ngx_socket_errno; |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
190 if (err != WSA_IO_PENDING) { |
543 | 191 ngx_log_error(NGX_LOG_ALERT, &ls->log, err, |
563 | 192 "AcceptEx() %V falied", &ls->addr_text); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
193 |
543 | 194 ngx_close_posted_connection(c); |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
195 return NGX_ERROR; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
196 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
197 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
198 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
199 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
200 return NGX_OK; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
201 } |
543 | 202 |
203 | |
204 static void | |
205 ngx_close_posted_connection(ngx_connection_t *c) | |
206 { | |
207 ngx_socket_t fd; | |
208 | |
209 ngx_free_connection(c); | |
210 | |
211 fd = c->fd; | |
212 c->fd = (ngx_socket_t) -1; | |
213 | |
214 if (ngx_close_socket(fd) == -1) { | |
215 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, | |
216 ngx_close_socket_n " failed"); | |
217 } | |
218 | |
219 if (c->pool) { | |
220 ngx_destroy_pool(c->pool); | |
221 } | |
222 } | |
223 | |
224 | |
225 u_char * | |
226 ngx_acceptex_log_error(ngx_log_t *log, u_char *buf, size_t len) | |
227 { | |
228 return ngx_snprintf(buf, len, " while posting AcceptEx() on %V", log->data); | |
229 } |