/// <summary> /// Processes an incoming command frame from the connection. /// </summary> /// <param name="frame">Command frame to process.</param> protected virtual void ProcessCommand(MqFrame frame) { var commandType = (MqCommandType)frame.ReadByte(0); switch (commandType) { case MqCommandType.Disconnect: CurrentState = State.Closing; Close((SocketCloseReason)frame.ReadByte(1)); break; default: Close(SocketCloseReason.ProtocolError); break; } }
/// <summary> /// Reads a byte value. /// 1 Byte /// </summary> public override byte ReadByte() { EnsureBuffer(1); var value = _currentFrame.ReadByte(_framePosition); _framePosition += 1; _absolutePosition += 1; return(value); }