From a0d59419f1c4d8eca345d81d0e5edb7b4dd7a3a9 Mon Sep 17 00:00:00 2001 From: CPunch Date: Wed, 19 Aug 2020 15:54:44 -0500 Subject: [PATCH] changed non-blocking failure to a socket shutdown --- src/CNProtocol.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/CNProtocol.cpp b/src/CNProtocol.cpp index c81d64a..d41e007 100644 --- a/src/CNProtocol.cpp +++ b/src/CNProtocol.cpp @@ -252,8 +252,15 @@ void CNServer::start() { #else if (fcntl(newConnection, F_SETFL, (fcntl(sock, F_GETFL, 0) | O_NONBLOCK)) != 0) { #endif - std::cerr << "[FATAL] OpenFusion: fcntl failed on new connection" << std::endl; - exit(EXIT_FAILURE); + std::cerr << "[WARN] OpenFusion: fcntl failed on new connection" << std::endl; + #ifdef _WIN32 + shutdown(newConnection, SD_BOTH); + closesocket(newConnection); + #else + shutdown(newConnection, SHUT_RDWR); + close(newConnection); + #endif + continue; } std::cout << "New connection! " << inet_ntoa(address.sin_addr) << std::endl;