Exemplo n.º 1
0
        public void Push(WrappedMemory memory)
        {
            if (memory == null)
            {
                return;
            }

            memory.Clear();
            this.stack.Push(memory);
        }
Exemplo n.º 2
0
        private void OnWriterComplete(IWrappedWriter writer)
        {
            WrappedMemory memory = writer as WrappedMemory;

            if (memory.Flag == MemoryFlag.Kcp)
            {
                var readableMemory = memory.GetReadableMemory();

                if (readableMemory.Length < 1)
                {
                    return;
                }
                //Console.WriteLine("kcp数据写入完成》》" + readableMemory.Length);
                this.sndQueue.Enqueue(memory);
            }
            else if (memory.Flag == MemoryFlag.Udp)
            {
                this.udpSession.Write(this.RemoteAddress, memory);
                this.udpSession.FlushAsync().NoAwait();
            }
        }