[nginx] Fixed handling of EAGAIN with sendfile in threads.

Valentin Bartenev vbart at nginx.com
Tue Mar 15 10:18:40 UTC 2016


details:   http://hg.nginx.org/nginx/rev/3b9c6b91d988
branches:  
changeset: 6431:3b9c6b91d988
user:      Valentin Bartenev <vbart at nginx.com>
date:      Mon Mar 14 22:42:35 2016 +0300
description:
Fixed handling of EAGAIN with sendfile in threads.

diffstat:

 src/os/unix/ngx_linux_sendfile_chain.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r 33aef5cd3d43 -r 3b9c6b91d988 src/os/unix/ngx_linux_sendfile_chain.c
--- a/src/os/unix/ngx_linux_sendfile_chain.c	Tue Mar 15 00:04:04 2016 +0300
+++ b/src/os/unix/ngx_linux_sendfile_chain.c	Mon Mar 14 22:42:35 2016 +0300
@@ -343,7 +343,12 @@ ngx_linux_sendfile_thread(ngx_connection
     if (task->event.complete) {
         task->event.complete = 0;
 
-        if (ctx->err && ctx->err != NGX_EAGAIN) {
+        if (ctx->err == NGX_EAGAIN) {
+            *sent = 0;
+            return NGX_AGAIN;
+        }
+
+        if (ctx->err) {
             wev->error = 1;
             ngx_connection_error(c, ctx->err, "sendfile() failed");
             return NGX_ERROR;



More information about the nginx-devel mailing list