# HG changeset patch # User Maxim Dounin # Date 1334654038 0 # Node ID 4be36d5e78aea7d7b9c7dd26fa10ea64ace28490 # Parent 089cc5154c1e75a96d17dbef65a4edd98a23ecce 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. diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c --- a/src/os/unix/ngx_readv_chain.c +++ b/src/os/unix/ngx_readv_chain.c @@ -71,6 +71,10 @@ ngx_readv_chain(ngx_connection_t *c, ngx 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 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;