aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_readv_chain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_readv_chain.c')
-rw-r--r--src/os/unix/ngx_readv_chain.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c
index b55e2f27e..5c2bb5af8 100644
--- a/src/os/unix/ngx_readv_chain.c
+++ b/src/os/unix/ngx_readv_chain.c
@@ -111,6 +111,21 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
}
}
+ if (n == 0) {
+
+ /*
+ * on FreeBSD recv() may return 0 on closed socket
+ * even if kqueue reported about available data
+ */
+
+ ngx_log_error(NGX_LOG_ALERT, c->log, 0,
+ "recv() returned 0 while kevent() reported "
+ "%d available bytes", rev->available);
+
+ rev->eof = 1;
+ rev->available = 0;
+ }
+
return n;
}