Ack Cut 1c: a new generation drops what the old one owed before the queue is asked for room

A bounded session whose queue still held an unacknowledged Accept for a peer
that vanished refused the next Connect; the old server-mode path reset before
accepting, so this would have been a regression. accept_connect and
create_connect now end the generation first in every runtime, and a test per
runtime holds a one-slot queue to it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 06:50:23 +02:00
commit 0abb8d4380
8 changed files with 100 additions and 12 deletions

View file

@ -178,6 +178,29 @@ namespace GameCult.Networking.Tests
Assert.That(client.Connected, Is.False, "an Accept revived an abandoned Connect");
}
[Test]
public void AFullQueueOwedToAVanishedPeerDoesNotRefuseANewGeneration()
{
static CultNetRudpSession Bounded(uint initialSequence) => new CultNetRudpSession(new CultNetRudpSessionOptions
{
ConnectionId = ConnectionId,
InitialSequence = initialSequence,
MaxPendingReliablePackets = 1
});
var server = Bounded(500);
server.AcceptConnect(Session(1).CreateConnect(0), 0);
Assert.That(server.OutstandingReliablePacketCount, Is.EqualTo(1), "the Accept is owed and never acknowledged");
var next = Session(9).CreateConnect(1);
server.AcceptConnect(next, 1);
Assert.That(server.ConnectRepeats(next), Is.True);
var client = Bounded(1);
client.CreateConnect(0);
client.CreateConnect(1);
Assert.That(client.OutstandingReliablePacketCount, Is.EqualTo(1), "only the new Connect is owed");
}
[Test]
public void ADuplicateAcceptDoesNotReseedTheWatermark()
{