fix(battle-node): thread session CT through every send instead of None

This commit is contained in:
gamer147
2026-06-01 11:12:26 -04:00
parent 8cce667e02
commit 453865ade2

View File

@@ -330,7 +330,7 @@ public sealed class BattleSession
var sio = SocketIoFrame.BinaryEventWithAttachments(eventName, new[] { bytes }); var sio = SocketIoFrame.BinaryEventWithAttachments(eventName, new[] { bytes });
var (text, bins) = sio.Encode(); var (text, bins) = sio.Encode();
var eioText = $"{(int)EngineIoPacketType.Message}{text}"; var eioText = $"{(int)EngineIoPacketType.Message}{text}";
await SendTextAsync(eioText, CancellationToken.None); await SendTextAsync(eioText, _sessionCt);
foreach (var bin in bins) foreach (var bin in bins)
{ {
// Engine.IO v3 binary frames are prefixed with the packet-type byte // Engine.IO v3 binary frames are prefixed with the packet-type byte
@@ -338,7 +338,7 @@ public sealed class BattleSession
var prefixed = new byte[bin.Length + 1]; var prefixed = new byte[bin.Length + 1];
prefixed[0] = (byte)EngineIoPacketType.Message; prefixed[0] = (byte)EngineIoPacketType.Message;
Buffer.BlockCopy(bin, 0, prefixed, 1, bin.Length); Buffer.BlockCopy(bin, 0, prefixed, 1, bin.Length);
await _ws.SendAsync(prefixed, WebSocketMessageType.Binary, endOfMessage: true, CancellationToken.None); await _ws.SendAsync(prefixed, WebSocketMessageType.Binary, endOfMessage: true, _sessionCt);
} }
} }
@@ -348,7 +348,7 @@ public sealed class BattleSession
var ack = SocketIoFrame.AckResponse(ackId, checked((int)arg)); var ack = SocketIoFrame.AckResponse(ackId, checked((int)arg));
var (text, _) = ack.Encode(); var (text, _) = ack.Encode();
var eioText = $"{(int)EngineIoPacketType.Message}{text}"; var eioText = $"{(int)EngineIoPacketType.Message}{text}";
await SendTextAsync(eioText, CancellationToken.None); await SendTextAsync(eioText, _sessionCt);
} }
private async Task SendEioOpenAsync(CancellationToken ct) private async Task SendEioOpenAsync(CancellationToken ct)