Skip to content

Commit

Permalink
fix: Prevent client shutdown from running twice (#2666)
Browse files Browse the repository at this point in the history
Co-authored-by: MrGadget1024 <chris@clevertech.net>
  • Loading branch information
MrGadget1024 and MrGadget1024 committed Mar 27, 2021
1 parent 2ec53df commit 008dbbc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Assets/Mirror/Runtime/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ internal static void OnDataReceived(ArraySegment<byte> data, int channelId)

static void OnDisconnected()
{
// StopClient called from user code triggers Disconnected event
// from transport which calls StopClient again, so check here
// and short circuit running the Shutdown process twice.
if (connectState == ConnectState.Disconnected) return;

connectState = ConnectState.Disconnected;
ready = false;

Expand Down

0 comments on commit 008dbbc

Please sign in to comment.