diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-04-17 09:13:58 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-04-17 09:13:58 +0000 |
| commit | 0abb0bce5f297546f8f982677707fb33dadb96d8 (patch) | |
| tree | dd5508c9ca4fdd3f68681410c96344537158cc2e | |
| parent | 578c02f3a1fda0ad43277af2af022c24f2e74104 (diff) | |
| download | nginx-0abb0bce5f297546f8f982677707fb33dadb96d8.tar.gz nginx-0abb0bce5f297546f8f982677707fb33dadb96d8.tar.bz2 | |
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.
| -rw-r--r-- | src/os/unix/ngx_readv_chain.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c index 373c4027c..7b6badfa8 100644 --- 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_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; |
