示例#1
0
        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));
            }
        }
示例#2
0
        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));
        }