Skip to content

Commit

Permalink
Fix exception on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpoz committed Nov 26, 2017
1 parent 21d89d7 commit cdacd25
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Client/GameSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ public void Disconnect()
{
if (connection.Connected)
{
connection.Client.Shutdown(SocketShutdown.Send);
connection.Client.BeginReceive(_receiveData, 0, _receiveData.Length, SocketFlags.None, SocketShutdownCallback, null);
try
{
connection.Client.Shutdown(SocketShutdown.Send);
connection.Client.BeginReceive(_receiveData, 0, _receiveData.Length, SocketFlags.None, SocketShutdownCallback, null);
}
catch(SocketException)
{
Disposed = true;
connection.Close();
}
}
else
{
Expand Down

0 comments on commit cdacd25

Please sign in to comment.