[ovs-dev] [PATCH] windows: Fix return value in case of named pipe send failure
Alin Balutoiu
abalutoiu at cloudbasesolutions.com
Tue May 8 14:36:17 UTC 2018
Acked-by: Alin Balutoiu <abalutoiu at cloudbasesolutions.com>
> -----Original Message-----
> From: ovs-dev-bounces at openvswitch.org <ovs-dev-
> bounces at openvswitch.org> On Behalf Of Alin Gabriel Serdean
> Sent: Monday, April 30, 2018 11:44 PM
> To: dev at openvswitch.org
> Cc: Alin Gabriel Serdean <aserdean at ovn.org>
> Subject: [ovs-dev] [PATCH] windows: Fix return value in case of named pipe send
> failure
>
> Named pipes should emulate UNIX socket behavior.
>
> Until now the named pipes returned WSA (Windows implementation of BSD
> sockets
> errors) return codes, for send errors.
>
> In case of a disconnected named pipe (UNIX socket) send error, we should
> return EPIPE.
>
> Fixes: `check_logs` transient errors when checking for EPIPE.
>
> Signed-off-by: Alin Gabriel Serdean <aserdean at ovn.org>
> ---
> lib/stream-windows.c | 6 +++---
> tests/test-vconn.c | 4 ----
> 2 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/lib/stream-windows.c b/lib/stream-windows.c index
> d908ee972..34bc610b6 100644
> --- a/lib/stream-windows.c
> +++ b/lib/stream-windows.c
> @@ -308,7 +308,7 @@ windows_send(struct stream *stream, const void
> *buffer, size_t n)
> || last_error == ERROR_NO_DATA
> || last_error == ERROR_BROKEN_PIPE) {
> /* If the pipe was disconnected, return connection reset. */
> - return -WSAECONNRESET;
> + return -EPIPE;
> } else {
> VLOG_ERR_RL(&rl, "Could not send data on named pipe. Last "
> "error: %s", ovs_lasterror_to_string()); @@ -321,7 +321,7 @@
> windows_send(struct stream *stream, const void *buffer, size_t n)
>
> result = WriteFile(s->fd, buffer, n, &(DWORD)retval, ov);
> last_error = GetLastError();
> - if (!result && GetLastError() == ERROR_IO_PENDING) {
> + if (!result && last_error == ERROR_IO_PENDING) {
> /* Mark the send operation as pending. */
> s->write_pending = true;
> return -EAGAIN;
> @@ -330,7 +330,7 @@ windows_send(struct stream *stream, const void
> *buffer, size_t n)
> || last_error == ERROR_NO_DATA
> || last_error == ERROR_BROKEN_PIPE)) {
> /* If the pipe was disconnected, return connection reset. */
> - return -WSAECONNRESET;
> + return -EPIPE;
> } else if (!result) {
> VLOG_ERR_RL(&rl, "Could not send data on synchronous named pipe. Last
> "
> "error: %s", ovs_lasterror_to_string()); diff --git a/tests/test-vconn.c
> b/tests/test-vconn.c index 0c17a8395..8b8d12e36 100644
> --- a/tests/test-vconn.c
> +++ b/tests/test-vconn.c
> @@ -163,11 +163,7 @@ test_refuse_connection(struct ovs_cmdl_context *ctx)
> error, ovs_strerror(error));
> }
> } else if (!strcmp(type, "unix")) { -#ifndef _WIN32
> CHECK_ERRNO(error, EPIPE);
> -#else
> - CHECK_ERRNO(error, WSAECONNRESET);
> -#endif
> } else if (!strcmp(type, "ssl")) {
> if (error != EPROTO && error != ECONNRESET) {
> ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
> --
> 2.16.1.windows.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
More information about the dev
mailing list