diff src/os/win32/ngx_wsarecv_chain.c @ 7887:ecf2a9002b37

Win32: use only preallocated memory in send/recv chain functions. The ngx_wsasend_chain() and ngx_wsarecv_chain() functions were modified to use only preallocated memory, and the number of preallocated wsabufs was increased to 64.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 05 Jul 2021 13:26:49 +0300
parents efd71d49bde0
children 56819a9491fe
line wrap: on
line diff
--- a/src/os/win32/ngx_wsarecv_chain.c
+++ b/src/os/win32/ngx_wsarecv_chain.c
@@ -10,7 +10,7 @@
 #include <ngx_event.h>
 
 
-#define NGX_WSABUFS  8
+#define NGX_WSABUFS  64
 
 
 ssize_t
@@ -57,6 +57,10 @@ ngx_wsarecv_chain(ngx_connection_t *c, n
             wsabuf->len += n;
 
         } else {
+            if (vec.nelts == vec.nalloc) {
+                break;
+            }
+
             wsabuf = ngx_array_push(&vec);
             if (wsabuf == NULL) {
                 return NGX_ERROR;