Skip to content

Commit

Permalink
fix: Fixed events being ran after disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoTenPvP committed Aug 12, 2019
1 parent 15f55dd commit 3e0006d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion MLAPI/Core/NetworkingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ private void Shutdown()
private float lastTimeSyncTime;
private void Update()
{
if(IsListening)
if (IsListening)
{
if ((NetworkTime - lastReceiveTickTime >= (1f / NetworkConfig.ReceiveTickrate)) || NetworkConfig.ReceiveTickrate <= 0)
{
Expand All @@ -634,6 +634,12 @@ private void Update()
NetworkProfiler.EndTick();
}

if (!IsListening)
{
// If we get disconnected in the previous poll. IsListening will be set to false.
return;
}

if (((NetworkTime - lastEventTickTime >= (1f / NetworkConfig.EventTickrate))))
{
NetworkProfiler.StartTick(TickType.Event);
Expand Down

0 comments on commit 3e0006d

Please sign in to comment.