honor C core's naming of verify_peer_callback arguments

pull/18591/head
Jan Tattermusch 6 years ago
parent 046cd3533b
commit d297ede96a
  1. 4
      src/csharp/Grpc.Core/ChannelCredentials.cs
  2. 18
      src/csharp/Grpc.Core/VerifyPeerContext.cs
  3. 8
      src/csharp/ext/grpc_csharp_ext.c

@ -226,7 +226,7 @@ namespace Grpc.Core
return VerifyPeerCallbackHandler(arg0, arg1, arg2 != IntPtr.Zero);
}
private int VerifyPeerCallbackHandler(IntPtr host, IntPtr pem, bool isDestroy)
private int VerifyPeerCallbackHandler(IntPtr targetName, IntPtr peerPem, bool isDestroy)
{
if (isDestroy)
{
@ -236,7 +236,7 @@ namespace Grpc.Core
try
{
var context = new VerifyPeerContext(Marshal.PtrToStringAnsi(host), Marshal.PtrToStringAnsi(pem));
var context = new VerifyPeerContext(Marshal.PtrToStringAnsi(targetName), Marshal.PtrToStringAnsi(peerPem));
return this.verifyPeerCallback(context) ? 0 : 1;
}

@ -27,22 +27,22 @@ namespace Grpc.Core
/// <summary>
/// Initializes a new instance of the <see cref="T:Grpc.Core.VerifyPeerContext"/> class.
/// </summary>
/// <param name="targetHost">string containing the host name of the peer.</param>
/// <param name="targetPem">string containing PEM encoded certificate of the peer.</param>
internal VerifyPeerContext(string targetHost, string targetPem)
/// <param name="targetName">The target name of the peer.</param>
/// <param name="peerPem">The PEM encoded certificate of the peer.</param>
internal VerifyPeerContext(string targetName, string peerPem)
{
this.TargetHost = targetHost;
this.TargetPem = targetPem;
this.TargetName = targetName;
this.PeerPem = peerPem;
}
/// <summary>
/// String containing the host name of the peer.
/// The target name of the peer.
/// </summary>
public string TargetHost { get; }
public string TargetName { get; }
/// <summary>
/// string containing PEM encoded certificate of the peer.
/// The PEM encoded certificate of the peer.
/// </summary>
public string TargetPem { get; }
public string PeerPem { get; }
}
}

@ -948,11 +948,11 @@ static void grpcsharp_verify_peer_destroy_handler(void* userdata) {
NULL, NULL);
}
static int grpcsharp_verify_peer_handler(const char* target_host,
const char* target_pem,
static int grpcsharp_verify_peer_handler(const char* target_name,
const char* peer_pem,
void* userdata) {
return native_callback_dispatcher(userdata, (void*)target_host,
(void*)target_pem, (void*)0, NULL,
return native_callback_dispatcher(userdata, (void*)target_name,
(void*)peer_pem, (void*)0, NULL,
NULL, NULL);
}

Loading…
Cancel
Save