]> git.kaiwu.me - nginx.git/commit
Simplified and improved sendfile() code on Linux.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 28 Mar 2017 15:15:39 +0000 (18:15 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 28 Mar 2017 15:15:39 +0000 (18:15 +0300)
commitff33d9fa55afa10674b60d4b36af1410c6870015
tree073380763224ea3a71422c0cf2d1cfc87a675396
parent9ad18e43ac2c9956399018cbb998337943988333
Simplified and improved sendfile() code on Linux.

The ngx_linux_sendfile() function is now used for both normal sendfile()
and sendfile in threads.  The ngx_linux_sendfile_thread() function was
modified to use the same interface as ngx_linux_sendfile(), and is simply
called from ngx_linux_sendfile() when threads are enabled.

Special return code NGX_DONE is used to indicate that a thread task was
posted and no further actions are needed.

If number of bytes sent is less that what we were sending, we now always
retry sending.  This is needed for sendfile() in threads as the number
of bytes we are sending might have been changed since the thread task
was posted.  And this is also needed for Linux 4.3+, as sendfile() might
be interrupted at any time and provides no indication if it was interrupted
or not (ticket #1174).
src/os/unix/ngx_linux_sendfile_chain.c