summaryrefslogtreecommitdiffhomepage
path: root/src/os/win32/ngx_sendv.c
blob: 7bf590eb75b2b29001163d3ccfec330f7a1e5c00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <ngx_core.h>
#include <ngx_types.h>
#include <ngx_errno.h>
#include <ngx_connection.h>
#include <ngx_log.h>
#include <ngx_sendv.h>

ssize_t ngx_sendv(ngx_connection_t *c, ngx_iovec_t *iovec, int n)
{
     int        rc;
     size_t     sent;
     ngx_err_t  err;

     ngx_log_debug(c->log, "WSASend() start");

     rc = WSASend(c->fd, iovec, n, &sent, 0, NULL, NULL);

     ngx_log_debug(c->log, "WSASend() done");

     if (rc == -1) {
         err = ngx_socket_errno;

         if (err == NGX_EAGAIN) {
             ngx_log_error(NGX_LOG_INFO, c->log, err, "WSASend() eagain");
             return NGX_AGAIN;
         }

         ngx_log_error(NGX_LOG_ERR, c->log, err, "WSASend() failed");
         return NGX_ERROR;
     }

     return sent;
}