GameCult.Networking: resend the capped frame's answer until acknowledged, then end the session
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 8m47s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 1m13s
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 8m47s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 1m13s
The schema server answered the 8th undecodable frame and ended the peer's session in the same call; ending clears the session's pending reliable packets, so a lost datagram was never resent. The session now stays until the peer has acknowledged every answer (a lost one is resent by PollResends) or a 2 s grace runs out, serves nothing after the capped frame meanwhile, and then sends the goodbye. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
337168812e
commit
0b1a468ddd
3 changed files with 149 additions and 2 deletions
|
|
@ -126,6 +126,12 @@ namespace GameCult.Networking
|
|||
/// </summary>
|
||||
public const int MaxConsecutiveRefusedFrames = 8;
|
||||
|
||||
/// <summary>
|
||||
/// How long a session whose capped frame was answered waits for the peer to acknowledge the answer
|
||||
/// before it ends anyway.
|
||||
/// </summary>
|
||||
internal const long CappedAnswerGraceMs = 2000;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the logger used by the server. R-AM: the dispatch backstop in DispatchAsync
|
||||
/// logs every untyped fault through this instead of swallowing it silently.
|
||||
|
|
@ -310,6 +316,9 @@ namespace GameCult.Networking
|
|||
{
|
||||
if (!string.Equals(delivered.Frame.ChannelId, "schema", StringComparison.Ordinal))
|
||||
return false;
|
||||
// The capped frame was answered: nothing after it is served while the answer is delivered.
|
||||
if (delivered.Peer.EndingReason != null)
|
||||
return false;
|
||||
|
||||
// A peer's message that cannot be decoded (malformed bytes, an unknown schemaVersion) or
|
||||
// handled ends that peer's session, never the poll: the drain goes on serving every other
|
||||
|
|
@ -337,8 +346,10 @@ namespace GameCult.Networking
|
|||
Logger.LogError($"CultNet RUDP schema server could not decode a peer's message ({ex.GetType().Name}); it was refused and that peer's session kept.");
|
||||
return false;
|
||||
}
|
||||
var ended = _transport.EndPeerSession(delivered.Peer, CultNetRudpSession.RefusedPacketReason);
|
||||
Logger.LogError($"CultNet RUDP schema server could not decode a peer's message ({ex.GetType().Name}); {SessionOutcome(ended)}");
|
||||
// The answer was sent reliably: the session ends once the peer has acknowledged it (a lost
|
||||
// datagram is resent first), or after the grace.
|
||||
_transport.EndPeerSessionWhenAnswered(delivered.Peer, CultNetRudpSession.RefusedPacketReason, CappedAnswerGraceMs);
|
||||
Logger.LogError($"CultNet RUDP schema server could not decode a peer's message ({ex.GetType().Name}); that peer's session ends once its answer is acknowledged.");
|
||||
return false;
|
||||
}
|
||||
_undecodableFramesInARow.GetOrCreateValue(delivered.Peer).Value = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue