summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c
diff options
context:
space:
mode:
authorrobert <robert@openbsd.org>2014-06-12 15:27:08 +0000
committerrobert <robert@openbsd.org>2014-06-12 15:27:08 +0000
commit48c5ce6cae7e303dfeee3a51091514ba4307bd3d (patch)
tree2c947b91869e053e1c22daedc8be6fc26be784d6 /usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c
parentDisable the "switch to insertion sort" optimization to avoid quadratic (diff)
downloadwireguard-openbsd-48c5ce6cae7e303dfeee3a51091514ba4307bd3d.tar.xz
wireguard-openbsd-48c5ce6cae7e303dfeee3a51091514ba4307bd3d.zip
update to 1.6.0 with official syslog support backported from the 1.7 branch
tested by several, ok sthen@
Diffstat (limited to 'usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c')
-rw-r--r--usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c b/usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c
index f58b5c20fe1..11cec82269a 100644
--- a/usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/usr.sbin/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -231,7 +231,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
&& c->tcp_nopush == NGX_TCP_NOPUSH_UNSET)
{
if (ngx_tcp_nopush(c->fd) == NGX_ERROR) {
- err = ngx_errno;
+ err = ngx_socket_errno;
/*
* there is a tiny chance to be interrupted, however,
@@ -368,9 +368,9 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
c->sent += sent;
- for (cl = in; cl; cl = cl->next) {
+ for ( /* void */ ; in; in = in->next) {
- if (ngx_buf_special(cl->buf)) {
+ if (ngx_buf_special(in->buf)) {
continue;
}
@@ -378,28 +378,28 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
break;
}
- size = ngx_buf_size(cl->buf);
+ size = ngx_buf_size(in->buf);
if (sent >= size) {
sent -= size;
- if (ngx_buf_in_memory(cl->buf)) {
- cl->buf->pos = cl->buf->last;
+ if (ngx_buf_in_memory(in->buf)) {
+ in->buf->pos = in->buf->last;
}
- if (cl->buf->in_file) {
- cl->buf->file_pos = cl->buf->file_last;
+ if (in->buf->in_file) {
+ in->buf->file_pos = in->buf->file_last;
}
continue;
}
- if (ngx_buf_in_memory(cl->buf)) {
- cl->buf->pos += (size_t) sent;
+ if (ngx_buf_in_memory(in->buf)) {
+ in->buf->pos += (size_t) sent;
}
- if (cl->buf->in_file) {
- cl->buf->file_pos += sent;
+ if (in->buf->in_file) {
+ in->buf->file_pos += sent;
}
break;
@@ -407,7 +407,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
#if (NGX_HAVE_AIO_SENDFILE)
if (c->busy_sendfile) {
- return cl;
+ return in;
}
#endif
@@ -421,7 +421,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
*/
wev->ready = 0;
- return cl;
+ return in;
}
if (eintr) {
@@ -430,13 +430,11 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
if (!complete) {
wev->ready = 0;
- return cl;
+ return in;
}
- if (send >= limit || cl == NULL) {
- return cl;
+ if (send >= limit || in == NULL) {
+ return in;
}
-
- in = cl;
}
}