예제 #1
0
        /// <summary>
        /// Sends out pending acknowledgements
        /// </summary>
        /// <returns>Number of ACKs sent</returns>
        private int SendAcks()
        {
            uint ack;
            int  ackCount = 0;

            if (PendingAcks.TryDequeue(out ack))
            {
                List <PacketAckPacket.PacketsBlock> blocks = new List <PacketAckPacket.PacketsBlock>();
                PacketAckPacket.PacketsBlock        block  = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                while (PendingAcks.TryDequeue(out ack))
                {
                    block    = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets         = blocks.ToArray();

                ackCount = blocks.Count;
                SendPacket(packet);
            }

            return(ackCount);
        }
예제 #2
0
        public void SendAcks(LLUDPClient udpClient)
        {
            uint ack;

            if (udpClient.PendingAcks.Dequeue(out ack))
            {
                List <PacketAckPacket.PacketsBlock> blocks = new List <PacketAckPacket.PacketsBlock>();
                PacketAckPacket.PacketsBlock        block  = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                while (udpClient.PendingAcks.Dequeue(out ack))
                {
                    block    = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets         = blocks.ToArray();

                SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true);
            }
        }
예제 #3
0
        public void SendAcks(LLAgent agent)
        {
            const int MAX_ACKS_PER_PACKET = Byte.MaxValue;

            uint ack;

            if (agent.PendingAcks.TryDequeue(out ack))
            {
                List <PacketAckPacket.PacketsBlock> blocks = new List <PacketAckPacket.PacketsBlock>(agent.PendingAcks.Count);
                PacketAckPacket.PacketsBlock        block  = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                int count = 1;

                while (count < MAX_ACKS_PER_PACKET && agent.PendingAcks.TryDequeue(out ack))
                {
                    block    = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);

                    ++count;
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets         = blocks.ToArray();

                SendPacket(agent, packet, ThrottleCategory.Unknown, false);
            }
        }
예제 #4
0
        /// <summary>
        /// Sends out pending acknowledgements
        /// </summary>
        private void SendAcks()
        {
            uint ack;

            if (PendingAcks.TryDequeue(out ack))
            {
                Interlocked.Decrement(ref PendingAckCount);

                List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>();
                PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                while (PendingAcks.TryDequeue(out ack))
                {
                    Interlocked.Decrement(ref PendingAckCount);

                    block = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets = blocks.ToArray();

                SendPacket(packet);
            }
        }
예제 #5
0
        public void SendAcks(LLUDPClient udpClient)
        {
            uint ack;

            if (udpClient.PendingAcks.Dequeue(out ack))
            {
                List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>();
                PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                while (udpClient.PendingAcks.Dequeue(out ack))
                {
                    block = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets = blocks.ToArray();

                SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true, null);
            }
        }
예제 #6
0
        /// <summary>
        /// Sends out pending acknowledgements
        /// </summary>
        /// <returns>Number of ACKs sent</returns>
        private int SendAcks()
        {
            uint ack;
            int ackCount = 0;

            if (PendingAcks.TryDequeue(out ack))
            {
                List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>();
                PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                while (PendingAcks.TryDequeue(out ack))
                {
                    block = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets = blocks.ToArray();

                ackCount = blocks.Count;
                SendPacket(packet);
            }

            return ackCount;
        }
예제 #7
0
        public void SendAcks(LLUDPClient udpClient)
        {
            uint ack;

            if (udpClient.PendingAcks.TryDequeue(out ack))
            {
                List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>();
                PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock {ID = ack};
                blocks.Add(block);

                while (udpClient.PendingAcks.TryDequeue(out ack))
                {
                    block = new PacketAckPacket.PacketsBlock {ID = ack};
                    blocks.Add(block);
                }

                PacketAckPacket packet = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
                packet.Header.Reliable = false;
                packet.Packets = blocks.ToArray();

                SendPacket(udpClient, packet, ThrottleOutPacketType.OutBand, true, null, null);
            }
        }
예제 #8
0
파일: LLUDPServer.cs 프로젝트: thoys/simian
        public void SendAcks(LLAgent agent)
        {
            const int MAX_ACKS_PER_PACKET = Byte.MaxValue;

            uint ack;
            if (agent.PendingAcks.TryDequeue(out ack))
            {
                List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(agent.PendingAcks.Count);
                PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock();
                block.ID = ack;
                blocks.Add(block);

                int count = 1;

                while (count < MAX_ACKS_PER_PACKET && agent.PendingAcks.TryDequeue(out ack))
                {
                    block = new PacketAckPacket.PacketsBlock();
                    block.ID = ack;
                    blocks.Add(block);

                    ++count;
                }

                PacketAckPacket packet = new PacketAckPacket();
                packet.Header.Reliable = false;
                packet.Packets = blocks.ToArray();

                SendPacket(agent, packet, ThrottleCategory.Unknown, false);
            }
        }