public override TResponse BlockingUnaryCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options, TRequest request) { var session = m_channel.GetSession(); using (var rpc = new RpcTunnel <TRequest, TResponse>(session, method)) { rpc.StartRequest(request); return(TaskUtil.GetResult(rpc.ReturnValueAsync(), options.CancellationToken)); } }
public override AsyncUnaryCall <TResponse> AsyncUnaryCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options, TRequest request) { var session = m_channel.GetSession(); var call = Task.Factory.StartNew(() => { using (var rpc = new RpcTunnel <TRequest, TResponse>(session, method)) { rpc.StartRequest(request); return(TaskUtil.GetResult(rpc.ReturnValueAsync(), options.CancellationToken)); } }); return(new AsyncUnaryCall <TResponse>(call)); }