From 1406c00abd3847ef83b310ce6075556b5ad68b4a Mon Sep 17 00:00:00 2001 From: ORelio Date: Tue, 20 Aug 2019 12:44:43 +0200 Subject: [PATCH] Fix SocketException causing InvalidDataException See #788 --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 48f3e0d1..403267bb 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -124,6 +124,7 @@ namespace MinecraftClient.Protocol.Handlers HandlePacket(packetID, new List(packetData)); } } + catch (System.IO.IOException) { return false; } catch (SocketException) { return false; } catch (NullReferenceException) { return false; } return true; @@ -529,6 +530,8 @@ namespace MinecraftClient.Protocol.Handlers } catch (Exception innerException) { + if (innerException is SocketException || innerException.InnerException is SocketException) + throw; //Connection lost rather than invalid data throw new System.IO.InvalidDataException( String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).", Protocol18PacketTypes.GetPacketIncomingType(packetID, protocolversion),