void PumpThread()
{
try
{
ProtocolHeader header = Reader.ReadHeader(this.connection.transport);
this.connection.OnHeader(header);
}
catch (Exception exception)
{
this.connection.OnIoException(exception);
return;
}
byte[] sizeBuffer = new byte[FixedWidth.UInt];
while (sizeBuffer != null && this.connection.state != State.End)
{
try
{
ByteBuffer buffer = Reader.ReadFrameBuffer(this.connection.transport, sizeBuffer, this.connection.maxFrameSize);
if (buffer != null)
{
this.connection.OnFrame(buffer);
}
else
{
sizeBuffer = null;
}
}
catch (Exception exception)
{
this.connection.OnIoException(exception);
}
}
}
}