comparison 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
comparison
equal deleted inserted replaced
7886:7f5e3595caff 7887:ecf2a9002b37
8 #include <ngx_config.h> 8 #include <ngx_config.h>
9 #include <ngx_core.h> 9 #include <ngx_core.h>
10 #include <ngx_event.h> 10 #include <ngx_event.h>
11 11
12 12
13 #define NGX_WSABUFS 8 13 #define NGX_WSABUFS 64
14 14
15 15
16 ssize_t 16 ssize_t
17 ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit) 17 ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit)
18 { 18 {
55 55
56 if (prev == chain->buf->last) { 56 if (prev == chain->buf->last) {
57 wsabuf->len += n; 57 wsabuf->len += n;
58 58
59 } else { 59 } else {
60 if (vec.nelts == vec.nalloc) {
61 break;
62 }
63
60 wsabuf = ngx_array_push(&vec); 64 wsabuf = ngx_array_push(&vec);
61 if (wsabuf == NULL) { 65 if (wsabuf == NULL) {
62 return NGX_ERROR; 66 return NGX_ERROR;
63 } 67 }
64 68