コード例 #1
0
ファイル: ServerRequestStream.cs プロジェクト: varung/grpc
        public Task <TRequest> ReadNext()
        {
            var taskSource = new AsyncCompletionTaskSource <TRequest>();

            call.StartReadMessage(taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
コード例 #2
0
        public async Task <bool> MoveNext(CancellationToken token)
        {
            if (token != CancellationToken.None)
            {
                throw new InvalidOperationException("Cancellation of individual reads is not supported.");
            }
            var taskSource = new AsyncCompletionTaskSource <TRequest>();

            call.StartReadMessage(taskSource.CompletionDelegate);
            var result = await taskSource.Task.ConfigureAwait(false);

            this.current = result;
            return(result != null);
        }