comparison src/os/unix/ngx_readv_chain.c @ 4597:4be36d5e78ae

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 17 Apr 2012 09:13:58 +0000
parents d620f497c50f
children 13c006f0c40e
comparison
equal deleted inserted replaced
4596:089cc5154c1e 4597:4be36d5e78ae
69 while (chain) { 69 while (chain) {
70 if (prev == chain->buf->last) { 70 if (prev == chain->buf->last) {
71 iov->iov_len += chain->buf->end - chain->buf->last; 71 iov->iov_len += chain->buf->end - chain->buf->last;
72 72
73 } else { 73 } else {
74 if (vec.nelts >= IOV_MAX) {
75 break;
76 }
77
74 iov = ngx_array_push(&vec); 78 iov = ngx_array_push(&vec);
75 if (iov == NULL) { 79 if (iov == NULL) {
76 return NGX_ERROR; 80 return NGX_ERROR;
77 } 81 }
78 82
193 while (chain) { 197 while (chain) {
194 if (prev == chain->buf->last) { 198 if (prev == chain->buf->last) {
195 iov->iov_len += chain->buf->end - chain->buf->last; 199 iov->iov_len += chain->buf->end - chain->buf->last;
196 200
197 } else { 201 } else {
202 if (vec.nelts >= IOV_MAX) {
203 break;
204 }
205
198 iov = ngx_array_push(&vec); 206 iov = ngx_array_push(&vec);
199 if (iov == NULL) { 207 if (iov == NULL) {
200 return NGX_ERROR; 208 return NGX_ERROR;
201 } 209 }
202 210