Harden CultNet snapshot fetches

This commit is contained in:
Meta Vens 2026-06-27 14:35:54 +01:00
commit 81b01ec41e
2 changed files with 54 additions and 1 deletions

View file

@ -1837,6 +1837,14 @@ namespace GameCult.Networking
{
return null;
}
catch (SocketException error) when (
error.SocketErrorCode == SocketError.ConnectionReset ||
error.SocketErrorCode == SocketError.ConnectionAborted ||
error.SocketErrorCode == SocketError.Shutdown)
{
DisconnectReason = Array.Empty<byte>();
return null;
}
_stats.BytesReceived += received;
if (_remoteEndPoint == null)
@ -2163,6 +2171,13 @@ namespace GameCult.Networking
{
return null;
}
catch (SocketException error) when (
error.SocketErrorCode == SocketError.ConnectionReset ||
error.SocketErrorCode == SocketError.ConnectionAborted ||
error.SocketErrorCode == SocketError.Shutdown)
{
return null;
}
_stats.BytesReceived += received;
var wire = new byte[received];