]> git.kaiwu.me - nginx.git/commitdiff
Fixed handling of EAGAIN with sendfile in threads.
authorValentin Bartenev <vbart@nginx.com>
Mon, 14 Mar 2016 19:42:35 +0000 (22:42 +0300)
committerValentin Bartenev <vbart@nginx.com>
Mon, 14 Mar 2016 19:42:35 +0000 (22:42 +0300)
src/os/unix/ngx_linux_sendfile_chain.c

index 9f272225a4df72aa129cd94f75a323d742b38d82..09c153059d38456db776e1c41f9d1225c028f346 100644 (file)
@@ -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;