summaryrefslogtreecommitdiffstats
path: root/src/msg/async/Event.cc
diff options
context:
space:
mode:
authorLucian Petrut <lpetrut@cloudbasesolutions.com>2020-11-13 13:18:32 +0100
committerLucian Petrut <lpetrut@cloudbasesolutions.com>2020-11-18 11:31:24 +0100
commit6ebd3d7b6f9a0c8c0d3377f38f96533fe537343c (patch)
tree065205fbff24d27b0707de68bd5fff298ea61910 /src/msg/async/Event.cc
parentrbd: Use the right device type on Windows (diff)
downloadceph-6ebd3d7b6f9a0c8c0d3377f38f96533fe537343c.tar.xz
ceph-6ebd3d7b6f9a0c8c0d3377f38f96533fe537343c.zip
compat,msg: improve Windows socket checks
win_socketpair can fail with EADDRINUSE under load, which will lead to an unhandled exception/crash as per this commit [1]. This change adds a retry, also ensuring that the right error code gets propagated (the one returned by WSAGetLastError() instead of the generic SOCKET_ERROR). While at it, we're fixing the "win_socketpair" indentation and addressing the SOCKET to int casts. [1] https://github.com/ceph/ceph/commit/633805060a1002c86570fe50d099e0c1e223e2d7 Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Diffstat (limited to '')
-rw-r--r--src/msg/async/Event.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/msg/async/Event.cc b/src/msg/async/Event.cc
index 1e109230282..2c545c07b37 100644
--- a/src/msg/async/Event.cc
+++ b/src/msg/async/Event.cc
@@ -148,16 +148,14 @@ int EventCenter::init(int nevent, unsigned center_id, const std::string &type)
int fds[2];
#ifdef _WIN32
- r = win_socketpair(fds);
- if (r != 0)
- return -r;
+ if (win_socketpair(fds) < 0) {
#else
if (pipe_cloexec(fds, 0) < 0) {
+ #endif
int e = ceph_sock_errno();
lderr(cct) << __func__ << " can't create notify pipe: " << cpp_strerror(e) << dendl;
return -e;
}
- #endif
notify_receive_fd = fds[0];
notify_send_fd = fds[1];