All pastes #517723 Raw Edit

Stuff

public text v1 · immutable
#517723 ·published 2007-05-29 03:24 UTC
rendered paste body
public unsafe bool FlushReceive()
        {
            if (base.Closed)
            {
                return true;
            }
            if (!base.Parent.AsyncReceive && !base.Parent.RequestData(this))
            {
                return true;
            }
            if (((this.EncodedLength != 0) && !this.m_firstPacket) && !this.m_authenticated)
            {
                return true;
            }
        Label_0045:
            if (base.Closed)
            {
                return true;
            }

            if (this.m_lastSize == 0)
            {
                if (!this.m_packetReceiveQueue.Dequeue(this.m_lastHeader, this.m_headerSize))
                {
                    //goto Label_0151;
                    return true;
                }
                this.m_lastSize = this.PacketSize(this.m_lastHeader);
                if (this.m_lastSize == -1)
                {
                    return false;
                }
            }

            if (this.m_packetReceiveQueue.Length >= (this.m_lastSize - this.m_headerSize))
            {
                byte* data = stackalloc byte[(1 * (this.m_lastSize - this.m_headerSize))];
                if (m_packetReceiveQueue.Dequeue(data, this.m_lastSize - this.m_headerSize))
                {
                    HeapBuffer heapBuffer = new HeapBuffer(this.m_lastSize);
                    heapBuffer.WriteData(this.m_lastHeader, 0, this.m_headerSize, 0);
                    heapBuffer.WriteData(data, 0, this.m_lastSize - this.m_headerSize, this.m_headerSize);
                    this.EnqueueIncomingPacket(new HeapBinReader(heapBuffer, this.m_lastSize));
                    this.m_lastSize = 0;
                    if (!this.m_firstPacket)
                    {
                        goto Label_0045;
                    }
                    this.m_firstPacket = false;
                    if (this.EncodedLength == 0)
                    {
                        goto Label_0045;
                    }
                    return true;
                }
            }
            return true;
        }