aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_solaris_sendfilev_chain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_solaris_sendfilev_chain.c')
-rw-r--r--src/os/unix/ngx_solaris_sendfilev_chain.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/os/unix/ngx_solaris_sendfilev_chain.c b/src/os/unix/ngx_solaris_sendfilev_chain.c
index a5b741f27..9cd1618a3 100644
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c
+++ b/src/os/unix/ngx_solaris_sendfilev_chain.c
@@ -16,7 +16,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
sendfilevec_t *sfv;
ngx_array_t vec;
ngx_event_t *wev;
- ngx_chain_t *cl;
+ ngx_chain_t *cl, *tail;
wev = c->write;
@@ -37,7 +37,7 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
/* create the sendfilevec and coalesce the neighbouring hunks */
- for (cl = in; cl; cl = cl->next) {
+ for (cl = in; cl && vec.nelts < IOV_MAX; cl = cl->next) {
if (ngx_hunk_special(cl->hunk)) {
continue;
}
@@ -77,6 +77,13 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
}
}
+ /*
+ * the tail is the rest of the chain that exceeded a single
+ * sendfilev() capability, IOV_MAX in Solaris is only 16
+ */
+
+ tail = cl;
+
n = sendfilev(c->fd, vec.elts, vec.nelts, &sent);
if (n == -1) {
@@ -142,7 +149,9 @@ ngx_chain_t *ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in)
in = cl;
- } while (eintr);
+ /* "tail == in" means that a single sendfilev() is complete */
+
+ } while ((tail && tail == in) || eintr);
if (in) {
wev->ready = 0;