Mercurial > hg > nginx
annotate auto/include @ 6806:75dbab4ea930
Events: improved error event handling for UDP sockets.
Normally, the epoll module calls the read and write handlers depending
on whether EPOLLIN and EPOLLOUT are reported by epoll_wait(). No error
processing is done in the module, the handlers are expected to get an
error when doing I/O.
If an error event is reported without EPOLLIN and EPOLLOUT, the module
set both EPOLLIN and EPOLLOUT to ensure the error event is handled at
least in one active handler.
This works well unless the error is delivered along with only one of
EPOLLIN or EPOLLOUT, and the corresponding handler does not do any I/O.
For example, it happened when getting EPOLLERR|EPOLLOUT from
epoll_wait() upon receiving "ICMP port unreachable" while proxying UDP.
As the write handler had nothing to send it was not able to detect and
log an error, and did not switch to the next upstream.
The fix is to unconditionally set EPOLLIN and EPOLLOUT in case of an
error event. In the aforementioned case, this causes the read handler
to be called which does recv() and detects an error.
In addition to the epoll module, analogous changes were made in
devpoll/eventport/poll.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Mon, 21 Nov 2016 16:03:42 +0300 |
parents | a616bdc38645 |
children |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
4 |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
455 | 6 echo $ngx_n "checking for $ngx_include ...$ngx_c" |
7 | |
8 cat << END >> $NGX_AUTOCONF_ERR | |
9 | |
10 ---------------------------------------- | |
11 checking for $ngx_include | |
12 | |
13 END | |
14 | |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
16 ngx_found=no |
197
0b81c7a0b133
nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
17 |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
18 cat << END > $NGX_AUTOTEST.c |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 |
2624
418c9f97bd01
fix FreeBSD before 7 building, broken in r2616
Igor Sysoev <igor@sysoev.ru>
parents:
645
diff
changeset
|
20 $NGX_INCLUDE_SYS_PARAM_H |
455 | 21 #include <$ngx_include> |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
22 |
6624
e3faa5fb7772
Configure: fix build with -Werror=old-style-definition.
Piotr Sikora <piotrsikora@google.com>
parents:
5309
diff
changeset
|
23 int main(void) { |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
24 return 0; |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
25 } |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
27 END |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
28 |
455 | 29 |
30 ngx_test="$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c" | |
31 | |
32 eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" | |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
34 if [ -x $NGX_AUTOTEST ]; then |
455 | 35 |
36 ngx_found=yes | |
37 | |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
38 echo " found" |
455 | 39 |
645 | 40 ngx_name=`echo $ngx_include \ |
41 | tr abcdefghijklmnopqrstuvwxyz/. ABCDEFGHIJKLMNOPQRSTUVWXYZ__` | |
455 | 42 |
43 | |
509 | 44 have=NGX_HAVE_$ngx_name . auto/have_headers |
455 | 45 |
46 eval "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'" | |
47 | |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 else |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
197
diff
changeset
|
49 echo " not found" |
455 | 50 |
51 echo "----------" >> $NGX_AUTOCONF_ERR | |
52 cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR | |
53 echo "----------" >> $NGX_AUTOCONF_ERR | |
54 echo $ngx_test >> $NGX_AUTOCONF_ERR | |
55 echo "----------" >> $NGX_AUTOCONF_ERR | |
196
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
56 fi |
11fbd0fc041d
nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
57 |
5309
434548349838
Configure: fixed autotest cleanup commands.
Sergey Kandaurov <pluknet@nginx.com>
parents:
4412
diff
changeset
|
58 rm -rf $NGX_AUTOTEST* |