Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        public PacketHandler(Ts3Crypt 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[Ts3Crypt.PacketTypeKinds];
            generationCounter = new uint[Ts3Crypt.PacketTypeKinds];
            this.ts3Crypt     = ts3Crypt;
            this.id           = id;
        }
Exemplo n.º 3
0
        public PacketHandler(Ts3Crypt ts3Crypt)
        {
            Util.Init(out packetAckManager);
            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[Ts3Crypt.PacketTypeKinds];
            generationCounter = new uint[Ts3Crypt.PacketTypeKinds];
            this.ts3Crypt     = ts3Crypt;
            resendThreadId    = -1;
        }