예제 #1
0
        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;

            Channel.RegisterActiveCall(this);
        }