Skip to content

Commit 366c647

Browse files
authored
Merge pull request #38 from leszekm1/master
fix pinging during upgrades
2 parents 0dc4b97 + 3636703 commit 366c647

File tree

1 file changed

+17
-3
lines changed
  • Src/EngineIoClientDotNet.mono/Client

1 file changed

+17
-3
lines changed

Src/EngineIoClientDotNet.mono/Client/Socket.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,18 @@ private void SetPing()
567567
var log2 = LogManager.GetLogger(Global.CallerName());
568568
log2.Info("EasyTimer SetPing start");
569569

570-
Ping();
571-
OnHeartbeat(PingTimeout);
572-
log2.Info("EasyTimer SetPing finish");
570+
if (Upgrading)
571+
{
572+
// skip this ping during upgrade
573+
SetPing();
574+
log2.Info("skipping Ping during upgrade");
575+
}
576+
else
577+
{
578+
Ping();
579+
OnHeartbeat(PingTimeout);
580+
log2.Info("EasyTimer SetPing finish");
581+
}
573582
}, (int)PingInterval);
574583
}
575584

@@ -663,6 +672,11 @@ private Task WaitForUpgrade()
663672
log.Info("Wait for upgrade timeout");
664673
break;
665674
}
675+
else
676+
{
677+
// yield to another thread
678+
System.Threading.Thread.Yield();
679+
}
666680
}
667681
tcs.SetResult(null);
668682
}

0 commit comments

Comments
 (0)