summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlin Gabriel Serdean <aserdean@ovn.org>2018-04-30 23:44:00 +0300
committerAlin Gabriel Serdean <aserdean@ovn.org>2018-05-08 18:28:51 +0300
commit5fffa669a7c14952305bd923ad423d6839fc3bf2 (patch)
tree2cc9fabe88c8b0025bbfa020f084d75b74b73b70
parent09f37a1b855bb2e774fa6b75405083977fdc3aa2 (diff)
downloadopenvswitch-5fffa669a7c14952305bd923ad423d6839fc3bf2.tar.gz
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@ovn.org> Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com> Acked-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--lib/stream-windows.c6
-rw-r--r--tests/test-vconn.c4
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)",