Skip to content
Branch: master
Find file History
mdounin 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.
Latest commit fac4c7b Oct 17, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
cc Win32: defined pdb path. Apr 4, 2019
lib Configure: fixed compiler warnings with "-Wall -Wextra". Jul 24, 2018
os Win32: enabled both select and poll on Windows by default. Jan 24, 2019
types Configure: stop polluting NGX_ namespace. Jun 27, 2016
configure
define Copyright updated. Jan 18, 2012
endianness Configure: fix build with -Werror=old-style-definition. Jun 27, 2016
feature Configure: fix build with -Werror=old-style-definition. Jun 27, 2016
have Copyright updated. Jan 18, 2012
have_headers Copyright updated. Jan 18, 2012
headers Copyright updated. Jan 18, 2012
include Configure: stop polluting NGX_ namespace. Jun 27, 2016
init Dynamic modules: do not overwrite old modules on install. Mar 10, 2016
install Configure: style. Mar 10, 2016
make Configure: added explicit ngx_binext to the linker output argument. Jan 30, 2019
module Configure: honor dependencies of dynamic modules. Nov 21, 2016
modules Unconditional compilation of the postpone filter. May 8, 2019
nohave Copyright updated. Jan 18, 2012
options Unconditional compilation of the postpone filter. May 8, 2019
sources Win32: added WSAPoll() support. Jan 24, 2019
stubs Copyright updated. Jan 18, 2012
summary Internal md5 and sha1 implementations are now always used. Jun 30, 2016
threads Configure: fixed static compilation with OpenSSL 1.1.1. Mar 22, 2018
unix Events: available bytes calculation via ioctl(FIONREAD). Oct 17, 2019
You can’t perform that action at this time.