Mercurial > hg > nginx-quic
annotate src/event/ngx_event_acceptex.c @ 4360:7447784028a7 stable-1.0
Merge of r4284:
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
for output of ./configure options, etc., since ngx_log_stderr() output
length is limited by 2048 characters defined as NGX_MAX_ERROR_STR.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 14 Dec 2011 15:23:23 +0000 |
parents | 00d436dbf826 |
children | d620f497c50f |
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 |
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
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
5 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #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
|
8 #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
|
9 #include <ngx_event.h> |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
543 | 12 static void ngx_close_posted_connection(ngx_connection_t *c); |
13 | |
14 | |
15 void | |
16 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
|
17 { |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
18 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
|
19 ngx_connection_t *c; |
3263
00d436dbf826
delete unused field c->local_socklen
Igor Sysoev <igor@sysoev.ru>
parents:
2535
diff
changeset
|
20 socklen_t len; |
59
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, |
3263
00d436dbf826
delete unused field c->local_socklen
Igor Sysoev <igor@sysoev.ru>
parents:
2535
diff
changeset
|
52 &c->local_sockaddr, &len, |
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 | |
2198
5975975eedc0
ngx_sock_ntop() takes family from sockaddr, remove duplicate field
Igor Sysoev <igor@sysoev.ru>
parents:
2049
diff
changeset
|
70 c->addr_text.len = ngx_sock_ntop(c->sockaddr, c->addr_text.data, |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
71 ls->addr_text_max_len, 0); |
461 | 72 if (c->addr_text.len == 0) { |
73 /* TODO: close socket */ | |
74 return; | |
75 } | |
76 } | |
77 | |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
78 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
|
79 |
561 | 80 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
|
81 |
2535
ec5825afc7eb
use variable for often used field
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
82 ls->handler(c); |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
83 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
84 return; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 |
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 |
543 | 89 ngx_int_t |
90 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
|
91 { |
280
7c7183b3ea8b
nginx-0.0.2-2004-03-05-11:34:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
92 u_long rcvd; |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
93 ngx_err_t err; |
543 | 94 ngx_log_t *log; |
95 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
|
96 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
|
97 ngx_socket_t s; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
98 ngx_connection_t *c; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
99 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 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
|
101 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 /* 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
|
103 |
2198
5975975eedc0
ngx_sock_ntop() takes family from sockaddr, remove duplicate field
Igor Sysoev <igor@sysoev.ru>
parents:
2049
diff
changeset
|
104 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
|
105 |
543 | 106 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &ls->log, 0, |
461 | 107 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
|
108 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
109 if (s == -1) { |
543 | 110 ngx_log_error(NGX_LOG_ALERT, &ls->log, ngx_socket_errno, |
111 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
|
112 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 return NGX_ERROR; |
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 |
543 | 116 c = ngx_get_connection(s, &ls->log); |
117 | |
118 if (c == NULL) { | |
119 return NGX_ERROR; | |
120 } | |
121 | |
122 c->pool = ngx_create_pool(ls->pool_size, &ls->log); | |
123 if (c->pool == NULL) { | |
124 ngx_close_posted_connection(c); | |
125 return NGX_ERROR; | |
126 } | |
127 | |
128 log = ngx_palloc(c->pool, sizeof(ngx_log_t)); | |
129 if (log == NULL) { | |
130 ngx_close_posted_connection(c); | |
131 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
|
132 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
133 |
543 | 134 c->buffer = ngx_create_temp_buf(c->pool, ls->post_accept_buffer_size |
135 + 2 * (ls->socklen + 16)); | |
136 if (c->buffer == NULL) { | |
137 ngx_close_posted_connection(c); | |
138 return NGX_ERROR; | |
139 } | |
140 | |
141 c->local_sockaddr = ngx_palloc(c->pool, ls->socklen); | |
142 if (c->local_sockaddr == NULL) { | |
143 ngx_close_posted_connection(c); | |
144 return NGX_ERROR; | |
145 } | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
146 |
543 | 147 c->sockaddr = ngx_palloc(c->pool, ls->socklen); |
148 if (c->sockaddr == NULL) { | |
149 ngx_close_posted_connection(c); | |
150 return NGX_ERROR; | |
151 } | |
152 | |
153 *log = ls->log; | |
154 c->log = log; | |
155 | |
156 c->recv = ngx_recv; | |
157 c->send = ngx_send; | |
577 | 158 c->recv_chain = ngx_recv_chain; |
543 | 159 c->send_chain = ngx_send_chain; |
160 | |
161 c->unexpected_eof = 1; | |
162 | |
163 c->listening = ls; | |
164 | |
561 | 165 rev = c->read; |
166 wev = c->write; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
167 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
168 rev->ovlp.event = rev; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 wev->ovlp.event = wev; |
509 | 170 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
|
171 |
461 | 172 rev->ready = 1; |
173 wev->ready = 1; | |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
174 |
543 | 175 rev->log = c->log; |
176 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
|
177 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
178 if (ngx_add_event(rev, 0, NGX_IOCP_IO) == NGX_ERROR) { |
543 | 179 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
|
180 return NGX_ERROR; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 } |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
182 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
183 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
|
184 ls->socklen + 16, ls->socklen + 16, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
185 &rcvd, (LPOVERLAPPED) &rev->ovlp) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
641
diff
changeset
|
186 == 0) |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
187 { |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
188 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
|
189 if (err != WSA_IO_PENDING) { |
543 | 190 ngx_log_error(NGX_LOG_ALERT, &ls->log, err, |
563 | 191 "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
|
192 |
543 | 193 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
|
194 return NGX_ERROR; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
195 } |
59
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 |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
199 return NGX_OK; |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
200 } |
543 | 201 |
202 | |
203 static void | |
204 ngx_close_posted_connection(ngx_connection_t *c) | |
205 { | |
206 ngx_socket_t fd; | |
207 | |
208 ngx_free_connection(c); | |
209 | |
210 fd = c->fd; | |
211 c->fd = (ngx_socket_t) -1; | |
212 | |
213 if (ngx_close_socket(fd) == -1) { | |
214 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, | |
215 ngx_close_socket_n " failed"); | |
216 } | |
217 | |
218 if (c->pool) { | |
219 ngx_destroy_pool(c->pool); | |
220 } | |
221 } | |
222 | |
223 | |
224 u_char * | |
225 ngx_acceptex_log_error(ngx_log_t *log, u_char *buf, size_t len) | |
226 { | |
227 return ngx_snprintf(buf, len, " while posting AcceptEx() on %V", log->data); | |
228 } |