Prove RUDP response resend across runtimes

This commit is contained in:
Meta Vens 2026-06-15 01:40:43 +01:00
commit 4209bbb9b6
5 changed files with 161 additions and 47 deletions

View file

@ -612,6 +612,7 @@ static void RudpServeOnce(Dictionary<string, string> options)
{
RequireRudpFrame(frame, "schema", "ts-csharp-client-state");
transport.Send("schema", Ascii("csharp-server-state"));
PollRudpAfterSend(transport, TimeSpan.FromMilliseconds(250));
WriteJsonLine(new { status = "ok" });
return;
}
@ -667,6 +668,17 @@ static void RudpDialOnce(Dictionary<string, string> options)
throw new TimeoutException("Timed out waiting for TypeScript RUDP response.");
}
static void PollRudpAfterSend(CultNetRudpSocketTransportConnection transport, TimeSpan duration)
{
var deadline = DateTimeOffset.UtcNow.Add(duration);
while (DateTimeOffset.UtcNow < deadline)
{
_ = transport.ReceiveOnce();
transport.PollResends();
Thread.Sleep(5);
}
}
static void RequireRudpFrame(CultNetTransportFrame frame, string expectedChannelId, string expectedPayload)
{
if (!string.Equals(frame.ChannelId, expectedChannelId, StringComparison.Ordinal)