From f084f6d4462bf2fe12116ce0584df4d76ac9eb0f Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 5 May 2010 18:18:16 +1200 Subject: [PATCH] fix (one) crash on connection drop --- OpenRA.Game/Network/Connection.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs index f50927fc0f..9ff34a78a2 100755 --- a/OpenRA.Game/Network/Connection.cs +++ b/OpenRA.Game/Network/Connection.cs @@ -135,10 +135,16 @@ namespace OpenRA.Network { base.Send( packet ); - var ms = new MemoryStream(); - ms.Write( BitConverter.GetBytes( (int)packet.Length ) ); - ms.Write( packet ); - ms.WriteTo( socket.GetStream() ); + try + { + + var ms = new MemoryStream(); + ms.Write(BitConverter.GetBytes((int)packet.Length)); + ms.Write(packet); + ms.WriteTo(socket.GetStream()); + + } + catch (SocketException) { /* drop this on the floor; we'll pick up the disconnect from the reader thread */ } } }