Mercurial > hg > nginx
annotate auto/lib/geoip/conf @ 7583:efd71d49bde0
Events: available bytes calculation via ioctl(FIONREAD).
This makes it possible to avoid looping for a long time while working
with a fast enough peer when data are added to the socket buffer faster
than we are able to read and process them (ticket #1431). This is
basically what we already do on FreeBSD with kqueue, where information
about the number of bytes in the socket buffer is returned by
the kevent() call.
With other event methods rev->available is now set to -1 when the socket
is ready for reading. Later in ngx_recv() and ngx_recv_chain(), if
full buffer is received, real number of bytes in the socket buffer is
retrieved using ioctl(FIONREAD). Reading more than this number of bytes
ensures that even with edge-triggered event methods the event will be
triggered again, so it is safe to stop processing of the socket and
switch to other connections.
Using ioctl(FIONREAD) only after reading a full buffer is an optimization.
With this approach we only call ioctl(FIONREAD) when there are at least
two recv()/readv() calls.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 17 Oct 2019 16:02:19 +0300 |
parents | a6d116645c51 |
children |
rev | line source |
---|---|
2985 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
2985 | 4 |
5 | |
6 ngx_feature="GeoIP library" | |
7 ngx_feature_name= | |
8 ngx_feature_run=no | |
5014
210b66a6fc7f
Configure: fixed GeoIP library detection.
Ruslan Ermilov <ru@nginx.com>
parents:
5013
diff
changeset
|
9 ngx_feature_incs="#include <GeoIP.h>" |
2985 | 10 ngx_feature_path= |
11 ngx_feature_libs="-lGeoIP" | |
12 ngx_feature_test="GeoIP_open(NULL, 0)" | |
13 . auto/feature | |
14 | |
15 | |
16 if [ $ngx_found = no ]; then | |
17 | |
18 # FreeBSD port | |
19 | |
20 ngx_feature="GeoIP library in /usr/local/" | |
5014
210b66a6fc7f
Configure: fixed GeoIP library detection.
Ruslan Ermilov <ru@nginx.com>
parents:
5013
diff
changeset
|
21 ngx_feature_path="/usr/local/include" |
2985 | 22 |
23 if [ $NGX_RPATH = YES ]; then | |
24 ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lGeoIP" | |
25 else | |
26 ngx_feature_libs="-L/usr/local/lib -lGeoIP" | |
27 fi | |
28 | |
29 . auto/feature | |
30 fi | |
31 | |
32 | |
33 if [ $ngx_found = no ]; then | |
34 | |
35 # NetBSD port | |
36 | |
37 ngx_feature="GeoIP library in /usr/pkg/" | |
5013
82a3f951feb3
Configure: fixed style of include directories.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
38 ngx_feature_path="/usr/pkg/include" |
2985 | 39 |
40 if [ $NGX_RPATH = YES ]; then | |
41 ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lGeoIP" | |
42 else | |
43 ngx_feature_libs="-L/usr/pkg/lib -lGeoIP" | |
44 fi | |
45 | |
46 . auto/feature | |
47 fi | |
48 | |
49 | |
50 if [ $ngx_found = no ]; then | |
51 | |
52 # MacPorts | |
53 | |
54 ngx_feature="GeoIP library in /opt/local/" | |
55 ngx_feature_path="/opt/local/include" | |
56 | |
57 if [ $NGX_RPATH = YES ]; then | |
58 ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lGeoIP" | |
59 else | |
60 ngx_feature_libs="-L/opt/local/lib -lGeoIP" | |
61 fi | |
62 | |
63 . auto/feature | |
64 fi | |
65 | |
66 | |
67 if [ $ngx_found = yes ]; then | |
5014
210b66a6fc7f
Configure: fixed GeoIP library detection.
Ruslan Ermilov <ru@nginx.com>
parents:
5013
diff
changeset
|
68 |
210b66a6fc7f
Configure: fixed GeoIP library detection.
Ruslan Ermilov <ru@nginx.com>
parents:
5013
diff
changeset
|
69 CORE_INCS="$CORE_INCS $ngx_feature_path" |
6383 | 70 |
71 if [ $USE_GEOIP = YES ]; then | |
72 CORE_LIBS="$CORE_LIBS $ngx_feature_libs" | |
73 fi | |
74 | |
75 NGX_LIB_GEOIP=$ngx_feature_libs | |
2985 | 76 |
6724
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
77 ngx_feature="GeoIP IPv6 support" |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
78 ngx_feature_name="NGX_HAVE_GEOIP_V6" |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
79 ngx_feature_run=no |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
80 ngx_feature_incs="#include <stdio.h> |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
81 #include <GeoIP.h>" |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
82 #ngx_feature_path= |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
83 #ngx_feature_libs= |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
84 ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);" |
a6d116645c51
Configure: removed the --with-ipv6 option.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6383
diff
changeset
|
85 . auto/feature |
5015 | 86 |
2985 | 87 else |
88 | |
89 cat << END | |
90 | |
91 $0: error: the GeoIP module requires the GeoIP library. | |
92 You can either do not enable the module or install the library. | |
93 | |
94 END | |
95 | |
96 exit 1 | |
97 fi |