[nginx] svn commit: r4598 - trunk/src/os/unix

mdounin at mdounin.ru mdounin at mdounin.ru
Tue Apr 17 09:13:58 UTC 2012


Author: mdounin
Date: 2012-04-17 09:13:58 +0000 (Tue, 17 Apr 2012)
New Revision: 4598
URL: http://trac.nginx.org/nginx/changeset/4598/nginx

Log:
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.


Modified:
   trunk/src/os/unix/ngx_readv_chain.c

Modified: trunk/src/os/unix/ngx_readv_chain.c
===================================================================
--- trunk/src/os/unix/ngx_readv_chain.c	2012-04-17 09:13:15 UTC (rev 4597)
+++ trunk/src/os/unix/ngx_readv_chain.c	2012-04-17 09:13:58 UTC (rev 4598)
@@ -71,6 +71,10 @@
             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 @@
             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;



More information about the nginx-devel mailing list