diff --git a/TShockAPI/Sockets/LinuxTcpSocket.cs b/TShockAPI/Sockets/LinuxTcpSocket.cs index 72e8e9d33..98df1674c 100644 --- a/TShockAPI/Sockets/LinuxTcpSocket.cs +++ b/TShockAPI/Sockets/LinuxTcpSocket.cs @@ -73,7 +73,20 @@ void ISocket.Connect(RemoteAddress address) private void ReadCallback(IAsyncResult result) { Tuple tuple = (Tuple)result.AsyncState; - tuple.Item1(tuple.Item2, this._connection.GetStream().EndRead(result)); + + try + { + tuple.Item1(tuple.Item2, this._connection.GetStream().EndRead(result)); + } + catch (InvalidOperationException) + { + // This is common behaviour during client disconnects + ((ISocket)this).Close(); + } + catch (Exception ex) + { + TShock.Log.Error(ex.ToString()); + } } private void SendCallback(IAsyncResult result)