static RpcResult HandlePong(BinaryReader br) { var msg = br.Apply(Peek(Pong.Deserialize)); var msgId = msg.MsgId; return(RpcResult.OfSuccess(msgId, br)); }
static RpcResult HandleRpcResult(BinaryReader br) { EnsureTypeNumber(br, RpcResultTypeNumber); var reqMsgId = br.ReadInt64(); var innerCode = PeekTypeNumber(br); switch (innerCode) { case RpcError.TypeNumber: EnsureTypeNumber(br, RpcError.TypeNumber); return(RpcError.DeserializeTag(br) .Apply(RpcResultErrorHandler.ToException) .Apply(exc => RpcResult.OfFail(reqMsgId, exc))); case GZipPackedTypeNumber: return(ReadGZipPacked(br).Apply(msgBr => RpcResult.OfSuccess(reqMsgId, msgBr))); default: return(RpcResult.OfSuccess(reqMsgId, br)); } }