Mercurial > hg > nginx
annotate auto/lib/openssl/make @ 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 | b329c0ab1a48 |
children | 3c4d81ea1338 |
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:
399
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:
399
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:
399
diff
changeset
|
4 |
583 | 5 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
6 case "$CC" in |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
7 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
8 cl) |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
9 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
10 cat << END >> $NGX_MAKEFILE |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
11 |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
12 $OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
13 \$(MAKE) -f auto/lib/openssl/makefile.msvc \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
14 OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
15 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
16 END |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
17 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
18 ;; |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
19 |
2897
d5d3fe7197cc
*) use no-threads for Unix builds only
Igor Sysoev <igor@sysoev.ru>
parents:
2879
diff
changeset
|
20 bcc32) |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
21 |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
22 ngx_opt=`echo "-DOPENSSL=\"$OPENSSL\" -DOPENSSL_OPT=\"$OPENSSL_OPT\"" \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
23 | sed -e "s/\//$ngx_regex_dirsep/g"` |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
24 |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
25 cat << END >> $NGX_MAKEFILE |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
26 |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
27 `echo "$OPENSSL\\openssl\\lib\\libeay32.lib: \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
28 $OPENSSL\\openssl\\include\\openssl\\ssl.h" \ |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
29 | sed -e "s/\//$ngx_regex_dirsep/g"` |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
30 |
2846
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
31 `echo "$OPENSSL\\openssl\\lib\\ssleay32.lib: \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
32 $OPENSSL\\openssl\\include\\openssl\\ssl.h" \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
33 | sed -e "s/\//$ngx_regex_dirsep/g"` |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
34 |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
35 `echo "$OPENSSL\\openssl\\include\\openssl\\ssl.h: $NGX_MAKEFILE" \ |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
36 | sed -e "s/\//$ngx_regex_dirsep/g"` |
dfec0e090265
fix building OpenSSL on Win32
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
37 \$(MAKE) -f auto/lib/openssl/makefile.bcc $ngx_opt |
2712
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
38 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
39 END |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
40 |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
41 ;; |
41f993457021
OpenSSL building by MSVC and BCC from sources
Igor Sysoev <igor@sysoev.ru>
parents:
1005
diff
changeset
|
42 |
399
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 *) |
2897
d5d3fe7197cc
*) use no-threads for Unix builds only
Igor Sysoev <igor@sysoev.ru>
parents:
2879
diff
changeset
|
44 case $OPENSSL in |
3168
83c940b0d18a
allow "make clean" for OpenSSL, the bug was introduced in r2874
Igor Sysoev <igor@sysoev.ru>
parents:
2897
diff
changeset
|
45 /*) ngx_prefix="$OPENSSL/.openssl" ;; |
83c940b0d18a
allow "make clean" for OpenSSL, the bug was introduced in r2874
Igor Sysoev <igor@sysoev.ru>
parents:
2897
diff
changeset
|
46 *) ngx_prefix="$PWD/$OPENSSL/.openssl" ;; |
2879
824d885aa0b1
allow absolute path in --with-openssl=
Igor Sysoev <igor@sysoev.ru>
parents:
2873
diff
changeset
|
47 esac |
824d885aa0b1
allow absolute path in --with-openssl=
Igor Sysoev <igor@sysoev.ru>
parents:
2873
diff
changeset
|
48 |
501 | 49 cat << END >> $NGX_MAKEFILE |
50 | |
3168
83c940b0d18a
allow "make clean" for OpenSSL, the bug was introduced in r2874
Igor Sysoev <igor@sysoev.ru>
parents:
2897
diff
changeset
|
51 $OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE |
501 | 52 cd $OPENSSL \\ |
5438
f817f9d1cded
Configure: call "make clean" for OpenSSL only if Makefile exists.
Piotr Sikora <piotr@cloudflare.com>
parents:
4412
diff
changeset
|
53 && if [ -f Makefile ]; then \$(MAKE) clean; fi \\ |
7247
b329c0ab1a48
Configure: restored "no-threads" in OpenSSL builds.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6404
diff
changeset
|
54 && ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT \\ |
2873 | 55 && \$(MAKE) \\ |
6404
09d5a22c76bd
Configure: skip building OpenSSL documentation to conserve time.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6017
diff
changeset
|
56 && \$(MAKE) install_sw LIBDIR=lib |
501 | 57 |
58 END | |
59 | |
399
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 ;; |
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
61 |
4e21d1291a14
nginx-0.0.7-2004-07-25-22:34:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 esac |