Beispiel #1
0
        public PacketHandler(TsCrypt ts3Crypt, Id id)
        {
            receiveQueueCommand       = new RingQueue <Packet <TIn> >(ReceivePacketWindowSize, ushort.MaxValue + 1);
            receiveQueueCommandLow    = new RingQueue <Packet <TIn> >(ReceivePacketWindowSize, ushort.MaxValue + 1);
            receiveWindowVoice        = new GenerationWindow(ushort.MaxValue + 1);
            receiveWindowVoiceWhisper = new GenerationWindow(ushort.MaxValue + 1);

            NetworkStats = new NetworkStats();

            packetCounter     = new ushort[TsCrypt.PacketTypeKinds];
            generationCounter = new uint[TsCrypt.PacketTypeKinds];
            this.tsCrypt      = ts3Crypt;
            this.id           = id;
        }
Beispiel #2
0
        public RingQueue(int maxBufferSize, int mod)
        {
            if (maxBufferSize >= mod)
            {
                throw new ArgumentOutOfRangeException(nameof(mod), "Modulo must be bigger than buffer size");
            }
            MaxBufferSize = maxBufferSize;
            var setBufferSize = Math.Min(InitialBufferSize, MaxBufferSize);

            ringBuffer    = new T[setBufferSize];
            ringBufferSet = new bool[setBufferSize];
            Window        = new GenerationWindow(mod, MaxBufferSize);
            Clear();
        }