diff options
author | 2016-01-19 09:18:42 -0800 | |
---|---|---|
committer | 2016-01-19 09:18:42 -0800 | |
commit | 2bd2b3e4269106012e0d423d0e2abc9cfca3b406 (patch) | |
tree | 00c63b7b5bdcd02bd8b44dce3674d981b2ce02ce /src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs | |
parent | d70b6dc761746015fc0dc70662dadd4bda533c7e (diff) | |
parent | 447ef7eaaac24bf236fff90c007e5b27b120b785 (diff) |
Merge pull request #4730 from jtattermusch/revamp_native_loader
Revamp C# native loader
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs')
-rw-r--r-- | src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs index 51e352a18b..a1d080c7f1 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs @@ -1,5 +1,5 @@ #region Copyright notice and license -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -41,11 +41,7 @@ namespace Grpc.Core.Internal /// </summary> internal class ServerCredentialsSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)] - static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, bool forceClientAuth); - - [DllImport("grpc_csharp_ext.dll")] - static extern void grpcsharp_server_credentials_release(IntPtr credentials); + static readonly NativeMethods Native = NativeMethods.Get(); private ServerCredentialsSafeHandle() { @@ -54,15 +50,15 @@ namespace Grpc.Core.Internal public static ServerCredentialsSafeHandle CreateSslCredentials(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, bool forceClientAuth) { Preconditions.CheckArgument(keyCertPairCertChainArray.Length == keyCertPairPrivateKeyArray.Length); - return grpcsharp_ssl_server_credentials_create(pemRootCerts, - keyCertPairCertChainArray, keyCertPairPrivateKeyArray, - new UIntPtr((ulong)keyCertPairCertChainArray.Length), - forceClientAuth); + return Native.grpcsharp_ssl_server_credentials_create(pemRootCerts, + keyCertPairCertChainArray, keyCertPairPrivateKeyArray, + new UIntPtr((ulong)keyCertPairCertChainArray.Length), + forceClientAuth); } protected override bool ReleaseHandle() { - grpcsharp_server_credentials_release(handle); + Native.grpcsharp_server_credentials_release(handle); return true; } } |