public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { bool isset_serverRole = false; bool isset_sampled = false; bool isset_baggage = false; bool isset_downstream = false; TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { ServerRole = await iprot.ReadStringAsync(cancellationToken); isset_serverRole = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.Bool) { Sampled = await iprot.ReadBoolAsync(cancellationToken); isset_sampled = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.String) { Baggage = await iprot.ReadStringAsync(cancellationToken); isset_baggage = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.Struct) { Downstream = new Downstream(); await Downstream.ReadAsync(iprot, cancellationToken); isset_downstream = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); if (!isset_serverRole) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_sampled) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_baggage) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_downstream) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } }
public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { bool isset_serviceName = false; bool isset_serverRole = false; bool isset_host = false; bool isset_port = false; bool isset_transport = false; TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { ServiceName = await iprot.ReadStringAsync(cancellationToken); isset_serviceName = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.String) { ServerRole = await iprot.ReadStringAsync(cancellationToken); isset_serverRole = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.String) { Host = await iprot.ReadStringAsync(cancellationToken); isset_host = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.String) { Port = await iprot.ReadStringAsync(cancellationToken); isset_port = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.I32) { Transport = (Transport)await iprot.ReadI32Async(cancellationToken); isset_transport = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 6: if (field.Type == TType.Struct) { Downstream_ = new Downstream(); await Downstream_.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); if (!isset_serviceName) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_serverRole) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_host) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_port) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_transport) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } }