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.
This commit is contained in:
dongresource 2023-03-06 02:14:45 +01:00
parent 7aabc507e7
commit fb5b0eeeb9

View File

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