aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_linux_sendfile_chain.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2016-03-14 22:42:35 +0300
committerValentin Bartenev <vbart@nginx.com>2016-03-14 22:42:35 +0300
commitb3c1abdcd8dd91ca1298c47b5abd567b9bcb3cf2 (patch)
treea4663a41bf9a7ef76aa412e2f3b4c4bba714874d /src/os/unix/ngx_linux_sendfile_chain.c
parent2b4a62c2fcde0ad98e1080ab13ba7429ba066619 (diff)
downloadnginx-b3c1abdcd8dd91ca1298c47b5abd567b9bcb3cf2.tar.gz
nginx-b3c1abdcd8dd91ca1298c47b5abd567b9bcb3cf2.zip
Fixed handling of EAGAIN with sendfile in threads.
Diffstat (limited to 'src/os/unix/ngx_linux_sendfile_chain.c')
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index 9f272225a..09c153059 100644
--- 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_t *c, ngx_buf_t *file, size_t size,
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;