Microsoft.Azure.Amqp.AmqpConnectionBase.OnReceiveFrameBuffer C# (CSharp) Method

OnReceiveFrameBuffer() private method

private OnReceiveFrameBuffer ( ByteBuffer buffer ) : void
buffer ByteBuffer
return void
        void OnReceiveFrameBuffer(ByteBuffer buffer)
        {
            if (this.State <= AmqpObjectState.OpenClosePipe)
            {
                Fx.Assert(buffer.Length == AmqpConstants.ProtocolHeaderSize, "protocol header size is wrong");
                try
                {
                    ProtocolHeader header = new ProtocolHeader();
                    header.Decode(buffer);
                    this.OnProtocolHeader(header);
                }
                catch (Exception exception)
                {
                    if (Fx.IsFatal(exception))
                    {
                        throw;
                    }

                    AmqpTrace.Provider.AmqpLogError(this, "OnProtocolHeader", exception.Message);

                    this.TerminalException = exception;
                    this.Abort();
                }
            }
            else
            {
                try
                {
                    this.OnFrameBuffer(buffer);
                }
                catch (Exception exception)
                {
                    if (Fx.IsFatal(exception))
                    {
                        throw;
                    }

                    AmqpTrace.Provider.AmqpLogError(this, "OnFrame", exception.Message);

                    this.SafeClose(exception);
                }
            }
        }
    }