public void PacketReceived(Packet packet)
 {
     lock (receivedPackets)
     {
         if (!PacketWasDeferred(packet))
         {
             receivedPackets.Enqueue(DEFAULT_PACKET_PRIORITY, packet);
         }
     }
 }
Esempio n. 2
0
        public void PrioritySanity()
        {
            NitroxModel.DataStructures.PriorityQueue <string> queue = new NitroxModel.DataStructures.PriorityQueue <string>();
            queue.Enqueue(2, "Second");
            queue.Enqueue(3, "First");
            queue.Enqueue(1, "Third");

            Assert.AreEqual("First", queue.Dequeue());
            Assert.AreEqual("Second", queue.Dequeue());
            Assert.AreEqual("Third", queue.Dequeue());
        }
Esempio n. 3
0
        public void SomeAreSameOrder()
        {
            NitroxModel.DataStructures.PriorityQueue <string> queue = new NitroxModel.DataStructures.PriorityQueue <string>();
            queue.Enqueue(2, "First");
            queue.Enqueue(2, "Second");
            queue.Enqueue(0, "Third");

            Assert.AreEqual("First", queue.Dequeue());
            Assert.AreEqual("Second", queue.Dequeue());
            Assert.AreEqual("Third", queue.Dequeue());
        }