| * Copyright (C) Igor Sysoev |
| ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain) |
| WSABUF wsabufs[NGX_WSABUFS]; |
| vec.size = sizeof(WSABUF); |
| vec.nalloc = NGX_WSABUFS; |
| /* coalesce the neighbouring bufs */ |
| if (prev == chain->buf->last) { |
| wsabuf->len += chain->buf->end - chain->buf->last; |
| wsabuf = ngx_array_push(&vec); |
| wsabuf->buf = (char *) chain->buf->last; |
| wsabuf->len = chain->buf->end - chain->buf->last; |
| size += chain->buf->end - chain->buf->last; |
| ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
| "WSARecv: %d:%d", vec.nelts, wsabuf->len); |
| rc = WSARecv(c->fd, vec.elts, vec.nelts, &bytes, &flags, NULL, NULL); |
| if (err == WSAEWOULDBLOCK) { |
| ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, |
| ngx_connection_error(c, err, "WSARecv() failed"); |