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);
}
}
}
}