Mercurial > hg > nginx
annotate src/event/ngx_event_acceptex.c @ 7349:f6047a579ca1
gRPC: improved keepalive handling.
The code is now able to parse additional control frames after
the response is received, and can send control frames as well.
This fixes keepalive problems as observed with grpc-c, which can
send window update and ping frames after the response, see
http://mailman.nginx.org/pipermail/nginx/2018-August/056620.html.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 03 Sep 2018 19:34:01 +0300 |
parents | bcd442b585f0 |
children | fdc3d40979b0 |
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); | |
6602
bcd442b585f0
Removed unused flag accept_context_updated from ngx_event_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6532
diff
changeset
|
44 /* TODO: close socket */ |
bcd442b585f0
Removed unused flag accept_context_updated from ngx_event_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6532
diff
changeset
|
45 return; |
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->listening = ls; | |
163 | |
561 | 164 rev = c->read; |
165 wev = c->write; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
166 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
167 rev->ovlp.event = rev; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
168 wev->ovlp.event = wev; |
509 | 169 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
|
170 |
461 | 171 rev->ready = 1; |
172 wev->ready = 1; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
173 |
543 | 174 rev->log = c->log; |
175 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
|
176 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
177 if (ngx_add_event(rev, 0, NGX_IOCP_IO) == NGX_ERROR) { |
543 | 178 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
|
179 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
180 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
182 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
|
183 ls->socklen + 16, ls->socklen + 16, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
184 &rcvd, (LPOVERLAPPED) &rev->ovlp) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
185 == 0) |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
186 { |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
187 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
|
188 if (err != WSA_IO_PENDING) { |
543 | 189 ngx_log_error(NGX_LOG_ALERT, &ls->log, err, |
6504 | 190 "AcceptEx() %V failed", &ls->addr_text); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
191 |
543 | 192 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
|
193 return NGX_ERROR; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
194 } |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
195 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
196 } |
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 return NGX_OK; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
199 } |
543 | 200 |
201 | |
202 static void | |
203 ngx_close_posted_connection(ngx_connection_t *c) | |
204 { | |
205 ngx_socket_t fd; | |
206 | |
207 ngx_free_connection(c); | |
208 | |
209 fd = c->fd; | |
210 c->fd = (ngx_socket_t) -1; | |
211 | |
212 if (ngx_close_socket(fd) == -1) { | |
213 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, | |
214 ngx_close_socket_n " failed"); | |
215 } | |
216 | |
217 if (c->pool) { | |
218 ngx_destroy_pool(c->pool); | |
219 } | |
220 } | |
221 | |
222 | |
223 u_char * | |
224 ngx_acceptex_log_error(ngx_log_t *log, u_char *buf, size_t len) | |
225 { | |
226 return ngx_snprintf(buf, len, " while posting AcceptEx() on %V", log->data); | |
227 } |