mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Fix unhandled exceptions during packet processing
This commit is contained in:
@@ -1698,15 +1698,23 @@ bool NetworkBase::ProcessConnection(NetworkConnection& connection)
|
||||
void NetworkBase::ProcessPacket(NetworkConnection& connection, NetworkPacket& packet)
|
||||
{
|
||||
const auto& handlerList = GetMode() == NETWORK_MODE_SERVER ? server_command_handlers : client_command_handlers;
|
||||
auto it = handlerList.find(packet.GetCommand());
|
||||
if (it != handlerList.end())
|
||||
|
||||
try
|
||||
{
|
||||
auto commandHandler = it->second;
|
||||
if (connection.AuthStatus == NetworkAuth::Ok || !packet.CommandRequiresAuth())
|
||||
auto it = handlerList.find(packet.GetCommand());
|
||||
if (it != handlerList.end())
|
||||
{
|
||||
(this->*commandHandler)(connection, packet);
|
||||
auto commandHandler = it->second;
|
||||
if (connection.AuthStatus == NetworkAuth::Ok || !packet.CommandRequiresAuth())
|
||||
{
|
||||
(this->*commandHandler)(connection, packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
log_verbose("Exception during packet processing: %s", ex.what());
|
||||
}
|
||||
|
||||
packet.Clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user