Fix protocol abuse exception.

This commit is contained in:
Pieter-Jan Briers
2023-07-27 19:30:39 +02:00
parent 0218c4b969
commit 9c64fbfce2
2 changed files with 8 additions and 2 deletions

View File

@@ -845,7 +845,13 @@ namespace Robust.Shared.Network
return true;
}
var channel = _channels[msg.SenderConnection];
if (!_channels.TryGetValue(msg.SenderConnection, out var channel))
{
_logger.Warning($"{msg.SenderConnection.RemoteEndPoint}: Got unexpected data packet before handshake completion.");
msg.SenderConnection.Disconnect("Unexpected packet before handshake completion");
return true;
}
var encryption = IsServer ? channel.Encryption : _clientEncryption;