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); 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;