示例#1
0
        public void Push(WrappedMemory memory)
        {
            if (memory == null)
            {
                return;
            }

            memory.Clear();
            this.stack.Push(memory);
        }
示例#2
0
        private void OnKcpSndEvent(uint conv, ref ReadOnlySequence <byte> memory)
        {
            //Console.WriteLine("kcp通知消息发送>>"+memory.Length);
            if (memory.Length < 1)
            {
                return;
            }

            int length = (int)memory.Length;

            sndMemory.Clear();
            var writableMemory = this.sndMemory.GetWritableMemory(length);

            memory.CopyTo(writableMemory.Span);
            this.sndMemory.WriterAdvance(length);

            this.udpSession.Write(this.RemoteAddress, this.sndMemory);
            this.udpSession.FlushAsync().NoAwait();
        }