From e842ee202ef006d37610e596616601120750e3b8 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Mon, 11 Sep 2023 12:53:08 +0200 Subject: [PATCH 1/2] Fixed unexpected POLLHUP event on connection failure on MacOS --- src/impl/pollservice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/impl/pollservice.cpp b/src/impl/pollservice.cpp index d7beca535..c03e6fc41 100644 --- a/src/impl/pollservice.cpp +++ b/src/impl/pollservice.cpp @@ -118,7 +118,9 @@ void PollService::process(std::vector &pfds) { auto &entry = jt->second; const auto ¶ms = entry.params; - if (it->revents & POLLNVAL || it->revents & POLLERR) { + if (it->revents & POLLNVAL || it->revents & POLLERR || + (it->revents & POLLHUP && + !(it->events & POLLIN))) { // MacOS sets POLLHUP on connection failure PLOG_VERBOSE << "Poll error event"; auto callback = std::move(params.callback); mSocks->erase(sock); From 0feb74cbcd3de826562f0dc1ed8427b6d75f0002 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Tue, 12 Sep 2023 13:37:03 +0200 Subject: [PATCH 2/2] Test IPv4 fallback in WebSocksetServer test --- test/websocketserver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/websocketserver.cpp b/test/websocketserver.cpp index 87d5ad983..c146f91b1 100644 --- a/test/websocketserver.cpp +++ b/test/websocketserver.cpp @@ -31,6 +31,7 @@ void test_websocketserver() { serverConfig.enableTls = true; // serverConfig.certificatePemFile = ... // serverConfig.keyPemFile = ... + serverConfig.bindAddress = "127.0.0.1"; // to test IPv4 fallback WebSocketServer server(std::move(serverConfig)); shared_ptr client;