diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-06-04 17:28:33 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-06-04 17:28:33 +0000 |
commit | 9cf783074fd7793ebb6859e7f62b054d79074efe (patch) | |
tree | b5bd9726d10952b0fab24754e2af210a9b644682 /src/os/unix/ngx_freebsd_sendfile_chain.c | |
parent | 1c10462e88491d52a23e22fbc3ca0012591df095 (diff) | |
download | nginx-9cf783074fd7793ebb6859e7f62b054d79074efe.tar.gz nginx-9cf783074fd7793ebb6859e7f62b054d79074efe.zip |
nginx-0.0.1-2003-06-04-21:28:33 import
Diffstat (limited to 'src/os/unix/ngx_freebsd_sendfile_chain.c')
-rw-r--r-- | src/os/unix/ngx_freebsd_sendfile_chain.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c index cd21ed904..a888c3613 100644 --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -105,17 +105,15 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) if (file) { - if (!c->tcp_nopush && ngx_freebsd_tcp_nopush_flush) { + if (!c->tcp_nopush && c->tcp_nopush_enabled) { c->tcp_nopush = 1; tcp_nopush = 1; - if (setsockopt(c->fd, IPPROTO_TCP, TCP_NOPUSH, - (const void *) &tcp_nopush, - sizeof(int)) == -1) - { - ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, - "setsockopt(TCP_NOPUSH) failed"); + if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, + ngx_tcp_nopush_n " failed"); return NGX_CHAIN_ERROR; } +ngx_log_debug(c->log, "NOPUSH"); } hdtr.headers = (struct iovec *) header.elts; @@ -222,21 +220,5 @@ ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in) } while ((tail && tail == ce) || eintr); - /* STUB: should be in app code, no need to clear TCP_NOPUSH - if the conneciton close()d or shutdown()ed */ - - if (c->tcp_nopush) { - c->tcp_nopush = 0; - tcp_nopush = 0; - if (setsockopt(c->fd, IPPROTO_TCP, TCP_NOPUSH, - (const void *) &tcp_nopush, - sizeof(int)) == -1) - { - ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, - "setsockopt(!TCP_NOPUSH) failed"); - return NGX_CHAIN_ERROR; - } - } - return ce; } |