2002-08-07 00:39:45 +08:00
|
|
|
|
2002-09-02 22:48:24 +08:00
|
|
|
#include <ngx_core.h>
|
2002-08-07 00:39:45 +08:00
|
|
|
#include <ngx_types.h>
|
2002-09-07 18:14:25 +08:00
|
|
|
#include <ngx_errno.h>
|
|
|
|
#include <ngx_connection.h>
|
|
|
|
#include <ngx_log.h>
|
2002-08-07 00:39:45 +08:00
|
|
|
#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-08-07 00:39:45 +08:00
|
|
|
{
|
2002-12-15 14:25:09 +08:00
|
|
|
ssize_t rc;
|
|
|
|
ngx_err_t err;
|
2002-09-02 22:48:24 +08:00
|
|
|
|
2002-12-15 14:25:09 +08:00
|
|
|
rc = writev(c->fd, iovec, n);
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2002-12-15 14:25:09 +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;
|
|
|
|
}
|
2002-09-07 18:14:25 +08:00
|
|
|
|
2002-12-15 14:25:09 +08:00
|
|
|
ngx_log_error(NGX_LOG_ERR, c->log, err, "sendv() failed");
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2002-12-15 14:25:09 +08:00
|
|
|
return rc;
|
2002-08-07 00:39:45 +08:00
|
|
|
}
|