예제 #1
0
 public bool Enqueue(byte[] buffer, int length)
 {
     if (buffer == null)
     {
         Console.WriteLine("Warning: Attempting to send null packet buffer");
         return(false);
     }
     if (this.m_Queue.Count == 0)
     {
         this.m_Queue.Enqueue(Server.Network.SendQueue.Entry.Pool(buffer, length, false));
         return(true);
     }
     if ((this.m_Buffered != null) && ((this.m_Buffered.m_Length + length) > this.m_Buffered.m_Buffer.Length))
     {
         this.m_Queue.Enqueue(this.m_Buffered);
         this.m_Buffered = null;
     }
     if (length >= SendQueue.m_CoalesceBufferSize)
     {
         this.m_Queue.Enqueue(Server.Network.SendQueue.Entry.Pool(buffer, length, false));
     }
     else
     {
         if (this.m_Buffered == null)
         {
             this.m_Buffered = Server.Network.SendQueue.Entry.Pool(SendQueue.GetUnusedBuffer(), 0, true);
         }
         Buffer.BlockCopy(buffer, 0, this.m_Buffered.m_Buffer, this.m_Buffered.m_Length, length);
         this.m_Buffered.m_Length += length;
     }
     return(false);
 }