Mercurial > hg > nginx-quic
comparison src/os/unix/ngx_freebsd_sendfile_chain.c @ 101:2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 04 Jun 2003 17:28:33 +0000 |
parents | a059e1aa65d4 |
children | 6dfda4cf5200 |
comparison
equal
deleted
inserted
replaced
100:7ebc8b7fb816 | 101:2e069b6e6920 |
---|---|
103 | 103 |
104 tail = ce; | 104 tail = ce; |
105 | 105 |
106 if (file) { | 106 if (file) { |
107 | 107 |
108 if (!c->tcp_nopush && ngx_freebsd_tcp_nopush_flush) { | 108 if (!c->tcp_nopush && c->tcp_nopush_enabled) { |
109 c->tcp_nopush = 1; | 109 c->tcp_nopush = 1; |
110 tcp_nopush = 1; | 110 tcp_nopush = 1; |
111 if (setsockopt(c->fd, IPPROTO_TCP, TCP_NOPUSH, | 111 if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { |
112 (const void *) &tcp_nopush, | 112 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, |
113 sizeof(int)) == -1) | 113 ngx_tcp_nopush_n " failed"); |
114 { | |
115 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, | |
116 "setsockopt(TCP_NOPUSH) failed"); | |
117 return NGX_CHAIN_ERROR; | 114 return NGX_CHAIN_ERROR; |
118 } | 115 } |
116 ngx_log_debug(c->log, "NOPUSH"); | |
119 } | 117 } |
120 | 118 |
121 hdtr.headers = (struct iovec *) header.elts; | 119 hdtr.headers = (struct iovec *) header.elts; |
122 hdtr.hdr_cnt = header.nelts; | 120 hdtr.hdr_cnt = header.nelts; |
123 hdtr.trailers = (struct iovec *) trailer.elts; | 121 hdtr.trailers = (struct iovec *) trailer.elts; |
220 | 218 |
221 in = ce; | 219 in = ce; |
222 | 220 |
223 } while ((tail && tail == ce) || eintr); | 221 } while ((tail && tail == ce) || eintr); |
224 | 222 |
225 /* STUB: should be in app code, no need to clear TCP_NOPUSH | |
226 if the conneciton close()d or shutdown()ed */ | |
227 | |
228 if (c->tcp_nopush) { | |
229 c->tcp_nopush = 0; | |
230 tcp_nopush = 0; | |
231 if (setsockopt(c->fd, IPPROTO_TCP, TCP_NOPUSH, | |
232 (const void *) &tcp_nopush, | |
233 sizeof(int)) == -1) | |
234 { | |
235 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, | |
236 "setsockopt(!TCP_NOPUSH) failed"); | |
237 return NGX_CHAIN_ERROR; | |
238 } | |
239 } | |
240 | |
241 return ce; | 223 return ce; |
242 } | 224 } |