Beispiel #1
0
        public Task <TResponse> ReadNext()
        {
            var taskSource = new AsyncCompletionTaskSource <TResponse>();

            call.StartReadMessage(taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
Beispiel #2
0
        public Task WriteResponseHeadersAsync(Metadata responseHeaders)
        {
            var taskSource = new AsyncCompletionTaskSource <object>();

            call.StartSendInitialMetadata(responseHeaders, taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
Beispiel #3
0
        public Task WriteAsync(TResponse message)
        {
            var taskSource = new AsyncCompletionTaskSource <object>();

            call.StartSendMessage(message, GetWriteFlags(), taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
Beispiel #4
0
        public Task WriteStatusAsync(Status status, Metadata trailers)
        {
            var taskSource = new AsyncCompletionTaskSource <object>();

            call.StartSendStatusFromServer(status, trailers, taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
Beispiel #5
0
        public Task Close()
        {
            var taskSource = new AsyncCompletionTaskSource <object>();

            call.StartSendCloseFromClient(taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
Beispiel #6
0
        public Task Write(TRequest message)
        {
            var taskSource = new AsyncCompletionTaskSource <object>();

            call.StartSendMessage(message, taskSource.CompletionDelegate);
            return(taskSource.Task);
        }
        public void OnNext(TResponse value)
        {
            var taskSource = new AsyncCompletionTaskSource();

            call.StartSendMessage(value, taskSource.CompletionDelegate);
            // TODO: how bad is the Wait here?
            taskSource.Task.Wait();
        }
        public void OnCompleted()
        {
            var taskSource = new AsyncCompletionTaskSource();

            call.StartSendStatusFromServer(new Status(StatusCode.OK, ""), taskSource.CompletionDelegate);
            // TODO: how bad is the Wait here?
            taskSource.Task.Wait();
        }
Beispiel #9
0
        public void OnCompleted()
        {
            var taskSource = new AsyncCompletionTaskSource();

            call.StartSendCloseFromClient(taskSource.CompletionDelegate);
            // TODO: how bad is the Wait here?
            taskSource.Task.Wait();
        }
        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);
        }
        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 <TResponse>();

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

            this.current = result;

            if (result == null)
            {
                await call.StreamingCallFinishedTask;
                return(false);
            }
            return(true);
        }