public GrpcCall(Method <TRequest, TResponse> method, GrpcMethodInfo grpcMethodInfo, CallOptions options, GrpcChannel channel) { // Validate deadline before creating any objects that require cleanup ValidateDeadline(options.Deadline); _callCts = new CancellationTokenSource(); // Run the callTcs continuation immediately to keep the same context. Required for Activity. _callTcs = new TaskCompletionSource <Status>(); Method = method; _grpcMethodInfo = grpcMethodInfo; Options = options; Channel = channel; Logger = channel.LoggerFactory.CreateLogger(LoggerName); _deadline = options.Deadline ?? DateTime.MaxValue; }
public GrpcCall(Method <TRequest, TResponse> method, GrpcMethodInfo grpcMethodInfo, CallOptions options, GrpcChannel channel, int attemptCount) : base(options, channel) { // Validate deadline before creating any objects that require cleanup ValidateDeadline(options.Deadline); _callCts = new CancellationTokenSource(); // Run the callTcs continuation immediately to keep the same context. Required for Activity. _callTcs = new TaskCompletionSource <Status>(); Method = method; _grpcMethodInfo = grpcMethodInfo; _deadline = options.Deadline ?? DateTime.MaxValue; _attemptCount = attemptCount; Channel.RegisterActiveCall(this); }
public GrpcCall(Method <TRequest, TResponse> method, GrpcMethodInfo grpcMethodInfo, CallOptions options, GrpcChannel channel) { // Validate deadline before creating any objects that require cleanup ValidateDeadline(options.Deadline); _callCts = new CancellationTokenSource(); // Run the callTcs continuation immediately to keep the same context. Required for Activity. _callTcs = new TaskCompletionSource <Status>(); Method = method; _grpcMethodInfo = grpcMethodInfo; Options = options; Channel = channel; Logger = channel.LoggerFactory.CreateLogger(LoggerName); if (options.Deadline != null && options.Deadline != DateTime.MaxValue) { var timeout = options.Deadline.GetValueOrDefault() - Channel.Clock.UtcNow; _timeout = (timeout > TimeSpan.Zero) ? timeout : TimeSpan.Zero; } }