From d0ba424cd126140da0ee87a3ea177004fe7374d0 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sat, 21 Sep 2013 12:22:22 -0400 Subject: [PATCH 1/2] Add in error ignore for the socket exception in the packet bufferer. --- TShockAPI/PacketBufferer.cs | 41 +++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index bc272788..ad454691 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -122,24 +122,35 @@ namespace TShockAPI public bool Flush(ServerSock socket) { - try - { - if (socket == null || !socket.active) - return false; + try + { + if (socket == null || !socket.active) + return false; - if (buffers[socket.whoAmI].Count < 1) - return false; + if (buffers[socket.whoAmI].Count < 1) + return false; - byte[] buff = buffers[socket.whoAmI].GetBytes(BytesPerUpdate); - if (buff == null) - return false; + byte[] buff = buffers[socket.whoAmI].GetBytes(BytesPerUpdate); + if (buff == null) + return false; - if (SendBytes(socket, buff)) - { - buffers[socket.whoAmI].Pop(buff.Length); - return true; - } - } + if (SendBytes(socket, buff)) + { + buffers[socket.whoAmI].Pop(buff.Length); + return true; + } + } + catch (SocketException e) + { + switch ((uint)e.ErrorCode) + { + case 0x80004005: + break; + default: + Log.ConsoleError(e.ToString()); + break; + } + } catch (Exception e) { Log.ConsoleError(e.ToString()); From b23cdb41c3a5e8ed46554ee780ef068cbb0b0bb3 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sat, 21 Sep 2013 12:52:46 -0400 Subject: [PATCH 2/2] Whelps, the info in the issue was not accurate. We are looking for the exception that writes a warning to the log file, not the console, not an error. This should be the right fix --- TShockAPI/PacketBufferer.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index ad454691..d18ac47f 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -139,17 +139,6 @@ namespace TShockAPI buffers[socket.whoAmI].Pop(buff.Length); return true; } - } - catch (SocketException e) - { - switch ((uint)e.ErrorCode) - { - case 0x80004005: - break; - default: - Log.ConsoleError(e.ToString()); - break; - } } catch (Exception e) { @@ -212,7 +201,14 @@ namespace TShockAPI } catch (SocketException e) { - Log.Warn(e.ToString()); + switch ((uint)e.ErrorCode) + { + case 0x80004005: + break; + default: + Log.Warn(e.ToString()); + break; + } } catch (IOException e) {