From a364f539adac6bc51f2a20bd545d981ed96f1c16 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Mon, 1 Jun 2026 11:41:47 -0400 Subject: [PATCH] refactor(battle-node): tighten Phase setter to private; document sid opacity --- SVSim.BattleNode/Sessions/BattleSession.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SVSim.BattleNode/Sessions/BattleSession.cs b/SVSim.BattleNode/Sessions/BattleSession.cs index aff41dc..a5afdd3 100644 --- a/SVSim.BattleNode/Sessions/BattleSession.cs +++ b/SVSim.BattleNode/Sessions/BattleSession.cs @@ -33,7 +33,7 @@ public sealed class BattleSession public string BattleId { get; } public long ViewerId { get; } - public BattleSessionPhase Phase { get; internal set; } = BattleSessionPhase.AwaitingInitNetwork; + public BattleSessionPhase Phase { get; private set; } = BattleSessionPhase.AwaitingInitNetwork; public InboundTracker Inbound { get; } = new(); public OutboundSequencer Outbound { get; } = new(); @@ -378,6 +378,10 @@ public sealed class BattleSession private async Task SendEioOpenAsync(CancellationToken ct) { + // SID format is server-internal; the EIO3 spec suggests a 20-char base64-url id, + // but BestHTTP's SocketIO client treats it as an opaque string and never validates + // shape. Hex-truncated Guid is fine in practice; revisit if we ever care about + // matching prod telemetry. var sid = Guid.NewGuid().ToString("N").Substring(0, 16); var handshake = new EngineIoHandshake(sid, Array.Empty(), 25000, 60000).ToJson(); await SendTextAsync($"0{handshake}", ct);