diff src/os/unix/ngx_linux_sendfile_chain.c @ 6431:3b9c6b91d988

Fixed handling of EAGAIN with sendfile in threads.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 14 Mar 2016 22:42:35 +0300
parents 768e287a6f36
children 4df3d9fcdee8
line wrap: on
line diff
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -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;