diff options
author | 2015-02-21 17:51:52 -0800 | |
---|---|---|
committer | 2015-02-23 11:35:49 -0800 | |
commit | 50faa8f78b210a9922644f624d3c0a36b4e2a2db (patch) | |
tree | d726e42f02f400a67090c5e7e4d0354bdd9de738 /src/csharp/Grpc.Core/Calls.cs | |
parent | 7c15ee88a2cde0fbb7d88a0a31ae772c6895efe9 (diff) |
Added support for true synchronous unary call and added some performance tests.
Diffstat (limited to 'src/csharp/Grpc.Core/Calls.cs')
-rw-r--r-- | src/csharp/Grpc.Core/Calls.cs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs index b67332676a..c0973234e2 100644 --- a/src/csharp/Grpc.Core/Calls.cs +++ b/src/csharp/Grpc.Core/Calls.cs @@ -47,19 +47,22 @@ namespace Grpc.Core { public static TResponse BlockingUnaryCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token) { + var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestSerializer, call.ResponseDeserializer); + return asyncCall.UnaryCall(call.Channel, call.MethodName, req); + //TODO: implement this in real synchronous style. - try { - return AsyncUnaryCall(call, req, token).Result; - } catch(AggregateException ae) { - foreach (var e in ae.InnerExceptions) - { - if (e is RpcException) - { - throw e; - } - } - throw; - } +// try { +// return AsyncUnaryCall(call, req, token).Result; +// } catch(AggregateException ae) { +// foreach (var e in ae.InnerExceptions) +// { +// if (e is RpcException) +// { +// throw e; +// } +// } +// throw; +// } } public static async Task<TResponse> AsyncUnaryCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token) |