Server closes connections gracefully so kick/ban/reset/shutdown messages arrive; status dot and HUD yellow until really connected (also while reconnecting)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 11:00:06 +02:00
co-authored by Claude Opus 5.5
parent 08844b18ac
commit 57e1d3d3a8
3 changed files with 70 additions and 8 deletions
+14
View File
@@ -155,6 +155,20 @@ try
watcher.Close();
await Task.Delay(300);
Console.WriteLine("== Kick reason arrives while the player keeps sending");
var spammer = await TestClient.Join("Spammer", 0, null);
var spamming = true;
var spamTask = Task.Run(async () => { while (spamming) { spammer.Send(MsgType.Player, PlayerPos(1f, 2f, 3f)); await Task.Delay(5); } });
await Task.Delay(300);
server.EnqueueCommand("kick " + spammer.Id + " testing");
var kickMsg = await spammer.WaitFor(MsgType.Reject, 3000);
spamming = false;
await spamTask;
Check(kickMsg != null && new BinaryReader(new MemoryStream(kickMsg)).ReadString().Contains("testing"),
"Kicked player receives the reason even while sending data (no hard reset)");
spammer.Close();
await Task.Delay(300);
Console.WriteLine("== reset-world makes everyone reconnect");
var r1 = await TestClient.Join("Resetter", 0, null);
server.EnqueueCommand("reset-world");