From ffd0fec2e31c1e03931f6a5dfac7d1b097a05cef Mon Sep 17 00:00:00 2001 From: Akseli Vanhamaa <31120156+megalithos@users.noreply.github.com> Date: Wed, 8 Jan 2025 00:36:43 +0200 Subject: [PATCH] Patch dos bug / vuln (#164) --- RiptideNetworking/RiptideNetworking/Transports/Udp/UdpPeer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RiptideNetworking/RiptideNetworking/Transports/Udp/UdpPeer.cs b/RiptideNetworking/RiptideNetworking/Transports/Udp/UdpPeer.cs index 378bab50..ad257d76 100644 --- a/RiptideNetworking/RiptideNetworking/Transports/Udp/UdpPeer.cs +++ b/RiptideNetworking/RiptideNetworking/Transports/Udp/UdpPeer.cs @@ -126,6 +126,8 @@ private void Receive() isRunning = false; break; case SocketError.ConnectionReset: + tryReceiveMore = true; + break; case SocketError.MessageSize: case SocketError.TimedOut: break; @@ -160,7 +162,7 @@ internal void Send(byte[] dataBuffer, int numBytes, IPEndPoint toEndPoint) if (isRunning) socket.SendTo(dataBuffer, numBytes, SocketFlags.None, toEndPoint); } - catch(SocketException) + catch (SocketException) { // May want to consider triggering a disconnect here (perhaps depending on the type // of SocketException)? Timeout should catch disconnections, but disconnecting