Пример #1
0
        /// <summary>
        /// Returns new instance of <see cref="CallOptions"/> with
        /// <c>CancellationToken</c> set to the value provided. Values of all other fields are preserved.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        public CallOptions WithCancellationToken(GrpcCancellationToken cancellationToken)
        {
            var newOptions = this;

            newOptions.cancellationToken = cancellationToken;
            return(newOptions);
        }
Пример #2
0
 internal ContextPropagationToken(CallSafeHandle parentCall, DateTime deadline, GrpcCancellationToken cancellationToken, ContextPropagationOptions options)
 {
     this.parentCall        = GrpcPreconditions.CheckNotNull(parentCall);
     this.deadline          = deadline;
     this.cancellationToken = cancellationToken;
     this.options           = options ?? ContextPropagationOptions.Default;
 }
Пример #3
0
 /// <summary>
 /// Creates a new instance of <c>CallOptions</c> struct.
 /// </summary>
 /// <param name="headers">Headers to be sent with the call.</param>
 /// <param name="deadline">Deadline for the call to finish. null means no deadline.</param>
 /// <param name="cancellationToken">Can be used to request cancellation of the call.</param>
 /// <param name="writeOptions">Write options that will be used for this call.</param>
 /// <param name="propagationToken">Context propagation token obtained from <see cref="ServerCallContext"/>.</param>
 /// <param name="credentials">Credentials to use for this call.</param>
 public CallOptions(Metadata headers          = null, DateTime?deadline = null, GrpcCancellationToken cancellationToken = default(GrpcCancellationToken),
                    WriteOptions writeOptions = null, ContextPropagationToken propagationToken = null, CallCredentials credentials = null)
 {
     this.headers           = headers;
     this.deadline          = deadline;
     this.cancellationToken = cancellationToken;
     this.writeOptions      = writeOptions;
     this.propagationToken  = propagationToken;
     this.credentials       = credentials;
 }