private void ProcessIncomingNonReliablePacket(UDPClient Sender, IncomingUDPPacket Packet)
 {
     IncomingUDPPacketsHolder.ProcessNonReliablePacket(Sender.IncomingNonReliablePacketHolder, Packet, (Buffer) =>
     {
         HandleReceivedBuffer(Sender, Buffer);
     });
 }
        protected override void ProcessReceivedBuffer(Client Sender, BufferStream Buffer)
        {
            ulong  lastAckID  = Buffer.ReadUInt64();
            uint   ackMask    = Buffer.ReadUInt32();
            bool   isReliable = Buffer.ReadBool();
            ulong  packetID   = Buffer.ReadUInt64();
            ushort sliceCount = Buffer.ReadUInt16();
            ushort sliceIndex = Buffer.ReadUInt16();

            BufferStream buffer = new BufferStream(Buffer.Buffer, Constants.UDP.PACKET_HEADER_SIZE, Buffer.Size - Constants.UDP.PACKET_HEADER_SIZE);

            UDPClient client = (UDPClient)Sender;

            IncomingUDPPacketsHolder incomingHolder = (isReliable ? client.IncomingReliablePacketHolder : client.IncomingNonReliablePacketHolder);

            IncomingUDPPacket packet = incomingHolder.GetPacket(packetID);

            if (packet == null)
            {
                packet = new IncomingUDPPacket(packetID, sliceCount);
                incomingHolder.AddPacket(packet);
            }

            packet.SetSliceBuffer(sliceIndex, buffer);

            if (packet.IsCompleted)
            {
                if (incomingHolder.LastID < packet.ID)
                {
                    incomingHolder.SetLastID(packet.ID);
                }

                if (isReliable)
                {
                    ProcessIncomingReliablePackets(client);
                }
                else
                {
                    ProcessIncomingNonReliablePacket(client, packet);
                }
            }

            OutgoingUDPPacketsHolder outgoingHolder = (isReliable ? client.OutgoingReliablePacketHolder : client.OutgoingNonReliablePacketHolder);

            outgoingHolder.SetLastAckID(lastAckID);
            outgoingHolder.SetAckMask(ackMask);

            if (isReliable)
            {
                ProcessOutgoingReliablePackets(client);
            }
            else
            {
                ProcessOutgoingNonReliablePackets(client);
            }
        }
 private void ProcessIncomingNonReliablePacket(IncomingUDPPacket Packet)
 {
     IncomingUDPPacketsHolder.ProcessNonReliablePacket(incomingNonReliablePacketHolder, Packet, HandleReceivedBuffer);
 }