Fixed ngx_readv_chain() to honor IOV_MAX (ticket #14).

Not using full chain passed is ok as consumers are expected to check
event's ready flag to determine if another call is needed, not the
returned size.
This commit is contained in:
Maxim Dounin 2012-04-17 09:13:58 +00:00
parent 578c02f3a1
commit 0abb0bce5f

View File

@ -71,6 +71,10 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
iov->iov_len += chain->buf->end - chain->buf->last;
} else {
if (vec.nelts >= IOV_MAX) {
break;
}
iov = ngx_array_push(&vec);
if (iov == NULL) {
return NGX_ERROR;
@ -195,6 +199,10 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
iov->iov_len += chain->buf->end - chain->buf->last;
} else {
if (vec.nelts >= IOV_MAX) {
break;
}
iov = ngx_array_push(&vec);
if (iov == NULL) {
return NGX_ERROR;