changed non-blocking failure to a socket shutdown

This commit is contained in:
CPunch 2020-08-19 15:54:44 -05:00
parent 94cb89dd6b
commit a0d59419f1

View File

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