Merge pull request #19526 from mgravell/mgravell/capture-ctx-handlenewserverrpc

csharp avoid capture-context in HandleNewServerRpc => HandleCallAsync
pull/13465/head
Jan Tattermusch 5 years ago committed by GitHub
commit d7bd178b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/csharp/Grpc.Core/Server.cs

@ -334,7 +334,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Selects corresponding handler for given call and handles the call. /// Selects corresponding handler for given call and handles the call.
/// </summary> /// </summary>
private async Task HandleCallAsync(ServerRpcNew newRpc, CompletionQueueSafeHandle cq, Action continuation) private async Task HandleCallAsync(ServerRpcNew newRpc, CompletionQueueSafeHandle cq, Action<Server, CompletionQueueSafeHandle> continuation)
{ {
try try
{ {
@ -351,7 +351,7 @@ namespace Grpc.Core
} }
finally finally
{ {
continuation(); continuation(this, cq);
} }
} }
@ -374,7 +374,7 @@ namespace Grpc.Core
// Don't await, the continuations will run on gRPC thread pool once triggered // Don't await, the continuations will run on gRPC thread pool once triggered
// by cq.Next(). // by cq.Next().
#pragma warning disable 4014 #pragma warning disable 4014
HandleCallAsync(newRpc, cq, () => AllowOneRpc(cq)); HandleCallAsync(newRpc, cq, (server, state) => server.AllowOneRpc(state));
#pragma warning restore 4014 #pragma warning restore 4014
} }
} }

Loading…
Cancel
Save