Skip to content
Snippets Groups Projects
Commit 65ca9dca authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

eliminate a thread switch when invoking server-side handler

parent 92a91569
No related branches found
No related tags found
No related merge requests found
...@@ -283,6 +283,8 @@ namespace Grpc.Core ...@@ -283,6 +283,8 @@ namespace Grpc.Core
/// </summary> /// </summary>
private void HandleNewServerRpc(bool success, BatchContextSafeHandle ctx) private void HandleNewServerRpc(bool success, BatchContextSafeHandle ctx)
{ {
Task.Run(AllowOneRpc);
if (success) if (success)
{ {
ServerRpcNew newRpc = ctx.GetServerRpcNew(this); ServerRpcNew newRpc = ctx.GetServerRpcNew(this);
...@@ -290,11 +292,9 @@ namespace Grpc.Core ...@@ -290,11 +292,9 @@ namespace Grpc.Core
// after server shutdown, the callback returns with null call // after server shutdown, the callback returns with null call
if (!newRpc.Call.IsInvalid) if (!newRpc.Call.IsInvalid)
{ {
Task.Run(async () => await HandleCallAsync(newRpc)).ConfigureAwait(false); HandleCallAsync(newRpc); // we don't need to await.
} }
} }
AllowOneRpc();
} }
/// <summary> /// <summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment