internal void OnReceiveCarrier( long curTime, ushort notificationAck, Action<NetEvent> deallocate) { this.traffic.OnReceiveOther(curTime); while (this.outgoing.Count > 0) { NetEvent front = this.outgoing.Peek(); if (NetUtil.UShortSeqDiff(notificationAck, front.Sequence) < 0) break; deallocate.Invoke(this.outgoing.Dequeue()); } }
public void TestReliableCleanup() { NetPeer netPeer = new NetPeer(null, "Token", false, 0); for (int i = 0; i < 20; i++) netPeer.QueueNotification(new NetEvent()); netPeer.OnReceiveCarrier(0, 10, (x) => x = null); // First sequence number is 1, so we should have 10 remaining Assert.AreEqual(10, netPeer.Outgoing.Count()); }