aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_writev_chain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_writev_chain.c')
-rw-r--r--src/os/unix/ngx_writev_chain.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c
index a752b1f91..805982d65 100644
--- a/src/os/unix/ngx_writev_chain.c
+++ b/src/os/unix/ngx_writev_chain.c
@@ -71,8 +71,8 @@ ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
/* create the iovec and coalesce the neighbouring bufs */
- for (cl = in; cl && vec.nelts < IOV_MAX && send < limit; cl = cl->next)
- {
+ for (cl = in; cl && send < limit; cl = cl->next) {
+
if (ngx_buf_special(cl->buf)) {
continue;
}
@@ -93,6 +93,10 @@ ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
iov->iov_len += size;
} else {
+ if (vec.nelts >= IOV_MAX) {
+ break;
+ }
+
iov = ngx_array_push(&vec);
if (iov == NULL) {
return NGX_CHAIN_ERROR;