MiniUDP.NetPeer.OnReceiveCarrier C# (CSharp) Метод

OnReceiveCarrier() приватный Метод

Cleans out any notifications older than the received carrier ack.
private OnReceiveCarrier ( long curTime, ushort notificationAck, Action deallocate ) : void
curTime long
notificationAck ushort
deallocate Action
Результат void
        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());
              }
        }

Usage Example

Пример #1
0
        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());
        }
All Usage Examples Of MiniUDP.NetPeer::OnReceiveCarrier