Mercurial > hg > nginx-vendor-current
diff src/os/unix/ngx_darwin_sendfile_chain.c @ 520:d41628eb4d0a NGINX_0_8_12
nginx 0.8.12
*) Feature: the "sendfile" parameter in the "aio" directive on FreeBSD.
*) Bugfix: in try_files; the bug had appeared in 0.8.11.
*) Bugfix: in memcached; the bug had appeared in 0.8.11.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 31 Aug 2009 00:00:00 +0400 |
parents | 0b6053502c55 |
children | d0f7a625f27c |
line wrap: on
line diff
--- a/src/os/unix/ngx_darwin_sendfile_chain.c +++ b/src/os/unix/ngx_darwin_sendfile_chain.c @@ -42,7 +42,7 @@ ngx_darwin_sendfile_chain(ngx_connection u_char *prev; off_t size, send, prev_send, aligned, sent, fprev; off_t header_size, file_size; - ngx_uint_t eintr, eagain, complete; + ngx_uint_t eintr, complete; ngx_err_t err; ngx_buf_t *file; ngx_array_t header, trailer; @@ -75,7 +75,6 @@ ngx_darwin_sendfile_chain(ngx_connection } send = 0; - eagain = 0; header.elts = headers; header.size = sizeof(struct iovec); @@ -238,22 +237,22 @@ ngx_darwin_sendfile_chain(ngx_connection if (rc == -1) { err = ngx_errno; - if (err == NGX_EAGAIN || err == NGX_EINTR) { - if (err == NGX_EINTR) { - eintr = 1; + switch (err) { + case NGX_EAGAIN: + break; - } else { - eagain = 1; - } + case NGX_EINTR: + eintr = 1; + break; - ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err, - "sendfile() sent only %O bytes", sent); - - } else { + default: wev->error = 1; (void) ngx_connection_error(c, err, "sendfile() failed"); return NGX_CHAIN_ERROR; } + + ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err, + "sendfile() sent only %O bytes", sent); } if (rc == 0 && sent == 0) { @@ -284,19 +283,22 @@ ngx_darwin_sendfile_chain(ngx_connection if (rc == -1) { err = ngx_errno; - if (err == NGX_EAGAIN || err == NGX_EINTR) { - if (err == NGX_EINTR) { - eintr = 1; - } + switch (err) { + case NGX_EAGAIN: + break; - ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, - "writev() not ready"); + case NGX_EINTR: + eintr = 1; + break; - } else { + default: wev->error = 1; ngx_connection_error(c, err, "writev() failed"); return NGX_CHAIN_ERROR; } + + ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, + "writev() not ready"); } sent = rc > 0 ? rc : 0;