aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-09-29 07:26:50 -0700
committerGravatar GitHub <noreply@github.com>2017-09-29 07:26:50 -0700
commitede8ed215603add55479e70407c59b0a62130f89 (patch)
tree491608661eed1383f2205cef577b6140bf67efa7 /src/csharp/Grpc.Core
parent226e9060b9ea47a3295d9311f237b9aecae996a3 (diff)
parent6456e494a8474f4d62594e98382678703dee9594 (diff)
Merge pull request #12374 from markdroth/plugin_credentials_api_fix
Change plugin credentials API to support both sync and async modes
Diffstat (limited to 'src/csharp/Grpc.Core')
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
index b56bdbb23f..a8cb357181 100644
--- a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
+++ b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
@@ -61,12 +61,9 @@ namespace Grpc.Core.Internal
try
{
- var context = new AuthInterceptorContext(Marshal.PtrToStringAnsi(serviceUrlPtr),
- Marshal.PtrToStringAnsi(methodNamePtr));
- // Don't await, we are in a native callback and need to return.
- #pragma warning disable 4014
- GetMetadataAsync(context, callbackPtr, userDataPtr);
- #pragma warning restore 4014
+ var context = new AuthInterceptorContext(Marshal.PtrToStringAnsi(serviceUrlPtr), Marshal.PtrToStringAnsi(methodNamePtr));
+ // Make a guarantee that credentials_notify_from_plugin is invoked async to be compliant with c-core API.
+ ThreadPool.QueueUserWorkItem(async (stateInfo) => await GetMetadataAsync(context, callbackPtr, userDataPtr));
}
catch (Exception e)
{