diff options
author | 2016-05-04 14:23:48 -0700 | |
---|---|---|
committer | 2016-05-09 15:42:31 -0700 | |
commit | 65ca9dcabc464a1ea9ea74b8891c77c27008dacd (patch) | |
tree | d62970f529cfbf1b9c7f33f05f80e0e1a2d5b273 /src/csharp/Grpc.Core | |
parent | 92a9156970945a9cdc9bff861435ce46c8a0594b (diff) |
eliminate a thread switch when invoking server-side handler
Diffstat (limited to 'src/csharp/Grpc.Core')
-rw-r--r-- | src/csharp/Grpc.Core/Server.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index 5b61b7f060..9b0895d855 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -283,6 +283,8 @@ namespace Grpc.Core /// </summary> private void HandleNewServerRpc(bool success, BatchContextSafeHandle ctx) { + Task.Run(AllowOneRpc); + if (success) { ServerRpcNew newRpc = ctx.GetServerRpcNew(this); @@ -290,11 +292,9 @@ namespace Grpc.Core // after server shutdown, the callback returns with null call if (!newRpc.Call.IsInvalid) { - Task.Run(async () => await HandleCallAsync(newRpc)).ConfigureAwait(false); + HandleCallAsync(newRpc); // we don't need to await. } } - - AllowOneRpc(); } /// <summary> |