Mercurial > hg > nginx-quic
annotate src/event/ngx_event_acceptex.c @ 5361:7094d6da2806
Win32: $request_time fixed.
On win32, time_t is 64 bits wide by default, and passing an ngx_msec_int_t
argument for %T format specifier doesn't work. This doesn't manifest itself
on other platforms as time_t and ngx_msec_int_t are usually of the same size.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 04 Sep 2013 20:48:30 +0400 |
parents | 3d2d3e1cf427 |
children | 1ab1cf63f885 |
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; |
3263
00d436dbf826
delete unused field c->local_socklen
Igor Sysoev <igor@sysoev.ru>
parents:
2535
diff
changeset
|
21 socklen_t len; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 |
461 | 23 c = rev->data; |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
24 ls = c->listening; |
461 | 25 |
543 | 26 c->log->handler = ngx_accept_log_error; |
27 | |
461 | 28 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
|
29 |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
30 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
|
31 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
|
32 "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
|
33 return; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
36 /* 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
|
37 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
38 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
|
39 (char *) &ls->fd, sizeof(ngx_socket_t)) |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
40 == -1) |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
41 { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
42 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, |
461 | 43 "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed for %V", |
44 &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
|
45 } else { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
46 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
|
47 } |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
48 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
49 ngx_getacceptexsockaddrs(c->buffer->pos, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
50 ls->post_accept_buffer_size, |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
51 ls->socklen + 16, |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
52 ls->socklen + 16, |
3263
00d436dbf826
delete unused field c->local_socklen
Igor Sysoev <igor@sysoev.ru>
parents:
2535
diff
changeset
|
53 &c->local_sockaddr, &len, |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
54 &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
|
55 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
56 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
|
57 c->buffer->last += rev->available; |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
58 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
|
59 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
60 } else { |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
61 c->buffer = NULL; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
62 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
63 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
64 if (ls->addr_ntop) { |
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
65 c->addr_text.data = ngx_pnalloc(c->pool, ls->addr_text_max_len); |
461 | 66 if (c->addr_text.data == NULL) { |
67 /* TODO: close socket */ | |
68 return; | |
69 } | |
70 | |
5263
05ba5bce31e0
Core: extended ngx_sock_ntop() with socklen parameter.
Vladimir Homutov <vl@nginx.com>
parents:
4412
diff
changeset
|
71 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
|
72 c->addr_text.data, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
73 ls->addr_text_max_len, 0); |
461 | 74 if (c->addr_text.len == 0) { |
75 /* TODO: close socket */ | |
76 return; | |
77 } | |
78 } | |
79 | |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
80 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
|
81 |
561 | 82 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
|
83 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
84 ls->handler(c); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
86 return; |
59
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 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
90 |
543 | 91 ngx_int_t |
92 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
|
93 { |
280
7c7183b3ea8b
nginx-0.0.2-2004-03-05-11:34:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
94 u_long rcvd; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
95 ngx_err_t err; |
543 | 96 ngx_log_t *log; |
97 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
|
98 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
|
99 ngx_socket_t s; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 ngx_connection_t *c; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 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
|
103 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
104 /* 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
|
105 |
2198
5975975eedc0
ngx_sock_ntop() takes family from sockaddr, remove duplicate field
Igor Sysoev <igor@sysoev.ru>
parents:
2049
diff
changeset
|
106 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
|
107 |
543 | 108 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &ls->log, 0, |
461 | 109 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
|
110 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5263
diff
changeset
|
111 if (s == (ngx_socket_t) -1) { |
543 | 112 ngx_log_error(NGX_LOG_ALERT, &ls->log, ngx_socket_errno, |
113 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
|
114 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
115 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
116 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
117 |
543 | 118 c = ngx_get_connection(s, &ls->log); |
119 | |
120 if (c == NULL) { | |
121 return NGX_ERROR; | |
122 } | |
123 | |
124 c->pool = ngx_create_pool(ls->pool_size, &ls->log); | |
125 if (c->pool == NULL) { | |
126 ngx_close_posted_connection(c); | |
127 return NGX_ERROR; | |
128 } | |
129 | |
130 log = ngx_palloc(c->pool, sizeof(ngx_log_t)); | |
131 if (log == NULL) { | |
132 ngx_close_posted_connection(c); | |
133 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
|
134 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
135 |
543 | 136 c->buffer = ngx_create_temp_buf(c->pool, ls->post_accept_buffer_size |
137 + 2 * (ls->socklen + 16)); | |
138 if (c->buffer == NULL) { | |
139 ngx_close_posted_connection(c); | |
140 return NGX_ERROR; | |
141 } | |
142 | |
143 c->local_sockaddr = ngx_palloc(c->pool, ls->socklen); | |
144 if (c->local_sockaddr == NULL) { | |
145 ngx_close_posted_connection(c); | |
146 return NGX_ERROR; | |
147 } | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
148 |
543 | 149 c->sockaddr = ngx_palloc(c->pool, ls->socklen); |
150 if (c->sockaddr == NULL) { | |
151 ngx_close_posted_connection(c); | |
152 return NGX_ERROR; | |
153 } | |
154 | |
155 *log = ls->log; | |
156 c->log = log; | |
157 | |
158 c->recv = ngx_recv; | |
159 c->send = ngx_send; | |
577 | 160 c->recv_chain = ngx_recv_chain; |
543 | 161 c->send_chain = ngx_send_chain; |
162 | |
163 c->unexpected_eof = 1; | |
164 | |
165 c->listening = ls; | |
166 | |
561 | 167 rev = c->read; |
168 wev = c->write; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
170 rev->ovlp.event = rev; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
171 wev->ovlp.event = wev; |
509 | 172 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
|
173 |
461 | 174 rev->ready = 1; |
175 wev->ready = 1; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
176 |
543 | 177 rev->log = c->log; |
178 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
|
179 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
180 if (ngx_add_event(rev, 0, NGX_IOCP_IO) == NGX_ERROR) { |
543 | 181 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
|
182 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
184 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
185 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
|
186 ls->socklen + 16, ls->socklen + 16, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
187 &rcvd, (LPOVERLAPPED) &rev->ovlp) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
188 == 0) |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
189 { |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
190 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
|
191 if (err != WSA_IO_PENDING) { |
543 | 192 ngx_log_error(NGX_LOG_ALERT, &ls->log, err, |
563 | 193 "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
|
194 |
543 | 195 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
|
196 return NGX_ERROR; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
197 } |
59
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 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
201 return NGX_OK; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
202 } |
543 | 203 |
204 | |
205 static void | |
206 ngx_close_posted_connection(ngx_connection_t *c) | |
207 { | |
208 ngx_socket_t fd; | |
209 | |
210 ngx_free_connection(c); | |
211 | |
212 fd = c->fd; | |
213 c->fd = (ngx_socket_t) -1; | |
214 | |
215 if (ngx_close_socket(fd) == -1) { | |
216 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, | |
217 ngx_close_socket_n " failed"); | |
218 } | |
219 | |
220 if (c->pool) { | |
221 ngx_destroy_pool(c->pool); | |
222 } | |
223 } | |
224 | |
225 | |
226 u_char * | |
227 ngx_acceptex_log_error(ngx_log_t *log, u_char *buf, size_t len) | |
228 { | |
229 return ngx_snprintf(buf, len, " while posting AcceptEx() on %V", log->data); | |
230 } |