Exemplo n.º 1
0
 public MessageDecoderResult Decodable(IoSession session, IoBuffer input)
 {
     if (input.Remaining < MIN_PACKET_LENGTH)
         return MessageDecoderResult.NeedData;
     var symbol = input.GetArray(2);
     if (DataPacket.True(symbol))
     {
         input.Skip(1);
         var len = input.Get();
         input.Rewind();
         if (len > input.Remaining) return MessageDecoderResult.NeedData;
     }
     else if (!CtlPacket.True(symbol)) return MessageDecoderResult.NotOK;
     return MessageDecoderResult.OK;
 }