protected override Boolean DoDecode(IoSession session, IoBuffer input, IProtocolDecoderOutput output) { if (!input.PrefixedDataAvailable(4, _maxObjectSize)) return false; input.GetInt32(); output.Write(input.GetObject()); return true; }
public MessageDecoderResult Decodable(IoSession session, IoBuffer input) { if (input.Remaining < MIN_REQUIRED_FRAME_LENGTH) return MessageDecoderResult.NeedData; try { Magic.ReadAndCheckMagic(input); } catch (Exception) { return MessageDecoderResult.NotOK; } var frameLength = input.GetInt32(); if (input.Remaining < frameLength) return MessageDecoderResult.NeedData; return MessageDecoderResult.OK; }