diff options
Diffstat (limited to '')
| -rw-r--r-- | src/os/win32/ngx_sendv.c | 34 | ||||
| -rw-r--r-- | src/os/win32/ngx_sendv.h | 3 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/os/win32/ngx_sendv.c b/src/os/win32/ngx_sendv.c new file mode 100644 index 000000000..7bf590eb7 --- /dev/null +++ b/src/os/win32/ngx_sendv.c @@ -0,0 +1,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; +} diff --git a/src/os/win32/ngx_sendv.h b/src/os/win32/ngx_sendv.h index 0de427610..0d20310b7 100644 --- a/src/os/win32/ngx_sendv.h +++ b/src/os/win32/ngx_sendv.h @@ -3,12 +3,13 @@ #include <ngx_config.h> +#include <ngx_connection.h> typedef WSABUF ngx_iovec_t; #define ngx_iov_base buf #define ngx_iov_len len -#define ngx_sendv(s, iovec, n, sent) WSASend(s, iovec, n, sent, 0, NULL, NULL) +ssize_t ngx_sendv(ngx_connection_t *c, ngx_iovec_t *iovec, int n); #endif /* _NGX_SENDV_H_INCLUDED_ */ |
