Prove RUDP response resend across runtimes
This commit is contained in:
parent
6040efb213
commit
4209bbb9b6
5 changed files with 161 additions and 47 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue