changeset 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 33aef5cd3d43
children cf3e75cfa951
files src/os/unix/ngx_linux_sendfile_chain.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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;