# HG changeset patch # User Valentin Bartenev # Date 1457984555 -10800 # Node ID 3b9c6b91d988a7435f9ef81263e4fad9536a45ab # Parent 33aef5cd3d4382901cfaffd3d9f74784c782e25f Fixed handling of EAGAIN with sendfile in threads. diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c --- 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;