nginx/src/os/unix/ngx_sendv.c

29 lines
609 B
C
Raw Normal View History

2002-09-02 22:48:24 +08:00
#include <ngx_core.h>
#include <ngx_types.h>
2002-09-07 18:14:25 +08:00
#include <ngx_errno.h>
#include <ngx_connection.h>
#include <ngx_log.h>
#include <ngx_sendv.h>
2002-09-07 18:14:25 +08:00
ssize_t ngx_sendv(ngx_connection_t *c, ngx_iovec_t *iovec, int n)
{
2002-09-02 22:48:24 +08:00
ssize_t rc;
2002-09-07 18:14:25 +08:00
ngx_err_t err;
2002-09-02 22:48:24 +08:00
2002-09-07 18:14:25 +08:00
rc = writev(c->fd, iovec, n);
2002-09-07 18:14:25 +08:00
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");
2002-09-02 22:48:24 +08:00
return NGX_ERROR;
2002-09-07 18:14:25 +08:00
}
2002-09-07 18:14:25 +08:00
return rc;
}