aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_sendv.c
blob: 409456890b61c2dc380a3c178cd8a671da04480b (plain)
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
#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)
{
     ssize_t rc;
     ngx_err_t err;

     rc = writev(c->fd, iovec, n);

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

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

     return rc;
}