Merge pull request #1344 from NyxStudios/mintaka-fix-crash

Catch and log on linux socket read
This commit is contained in:
Lucas Nicodemus 2016-12-14 14:17:38 -07:00 committed by GitHub
commit d8118f2ede

View file

@ -73,7 +73,20 @@ namespace TShockAPI.Sockets
private void ReadCallback(IAsyncResult result)
{
Tuple<SocketReceiveCallback, object> tuple = (Tuple<SocketReceiveCallback, object>)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)