#region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Threading.Tasks;
namespace Grpc.Core
{
///
/// Return type for bidirectional streaming calls.
///
/// Request message type for this call.
/// Response message type for this call.
public sealed class AsyncDuplexStreamingCall : IDisposable
{
readonly IClientStreamWriter requestStream;
readonly IAsyncStreamReader responseStream;
readonly AsyncCallState callState;
///
/// Creates a new AsyncDuplexStreamingCall object with the specified properties.
///
/// Stream of request values.
/// Stream of response values.
/// Response headers of the asynchronous call.
/// Delegate returning the status of the call.
/// Delegate returning the trailing metadata of the call.
/// Delegate to invoke when Dispose is called on the call object.
public AsyncDuplexStreamingCall(IClientStreamWriter requestStream,
IAsyncStreamReader responseStream,
Task responseHeadersAsync,
Func getStatusFunc,
Func getTrailersFunc,
Action disposeAction)
{
this.requestStream = requestStream;
this.responseStream = responseStream;
this.callState = new AsyncCallState(responseHeadersAsync, getStatusFunc, getTrailersFunc, disposeAction);
}
///
/// Creates a new AsyncDuplexStreamingCall object with the specified properties.
///
/// Stream of request values.
/// Stream of response values.
/// Response headers of the asynchronous call.
/// Delegate returning the status of the call.
/// Delegate returning the trailing metadata of the call.
/// Delegate to invoke when Dispose is called on the call object.
/// State object for use with the callback parameters.
public AsyncDuplexStreamingCall(IClientStreamWriter requestStream,
IAsyncStreamReader responseStream,
Func