From fb5b0eeeb996dd880f7ee743787c00404a72471a Mon Sep 17 00:00:00 2001 From: dongresource Date: Mon, 6 Mar 2023 02:14:45 +0100 Subject: [PATCH] Make socket connection state mismatch into a fatal error These problems are usually not ephemeral, and cause persistent console spam, so they should immediately crash the server so they can be investigated. --- src/core/CNProtocol.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/CNProtocol.cpp b/src/core/CNProtocol.cpp index c15fdb7..9ebf98d 100644 --- a/src/core/CNProtocol.cpp +++ b/src/core/CNProtocol.cpp @@ -479,8 +479,9 @@ void CNServer::start() { // player sockets if (connections.find(fds[i].fd) == connections.end()) { - std::cout << "[WARN] Event on non-existant socket?" << std::endl; - continue; // just to be safe + std::cout << "[FATAL] Event on non-existent socket: " << fds[i].fd << std::endl; + assert(0); + /* not reached */ } CNSocket* cSock = connections[fds[i].fd];