diff options
Diffstat (limited to 'src/os/unix/ngx_readv_chain.c')
-rw-r--r-- | src/os/unix/ngx_readv_chain.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c index 0e99cb413..b55e2f27e 100644 --- a/src/os/unix/ngx_readv_chain.c +++ b/src/os/unix/ngx_readv_chain.c @@ -32,26 +32,23 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) rev->pending_eof, rev->available, rev->kq_errno); if (rev->available == 0) { - - if (!rev->pending_eof) { - return NGX_AGAIN; - } - - /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */ - if (rev->kq_errno != NGX_ETIMEDOUT) { - + if (rev->pending_eof) { rev->ready = 0; rev->eof = 1; + ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno, + "kevent() reported about an closed connection"); + if (rev->kq_errno) { rev->error = 1; ngx_set_socket_errno(rev->kq_errno); - - return ngx_connection_error(c, rev->kq_errno, - "kevent() reported about an closed connection"); + return NGX_ERROR; } return 0; + + } else { + return NGX_AGAIN; } } } @@ -100,8 +97,8 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) rev->available -= n; /* - * rev->available can be negative here because some additional - * bytes can be received between kevent() and recv() + * rev->available may be negative here because some additional + * bytes may be received between kevent() and recv() */ if (rev->available <= 0) { |