private static string GetOverridenTarget(string target, ChannelArgs args) { if (args != null && !string.IsNullOrEmpty(args.GetSslTargetNameOverride())) { return(args.GetSslTargetNameOverride()); } return(target); }
private static ChannelArgsSafeHandle CreateNativeChannelArgs(ChannelArgs args) { if (args == null) { return(ChannelArgsSafeHandle.CreateNull()); } return(args.ToNativeChannelArgs()); }
/// <summary> /// Creates a channel. /// </summary> public Channel(string target, Credentials credentials = null, ChannelArgs channelArgs = null) { using (ChannelArgsSafeHandle nativeChannelArgs = CreateNativeChannelArgs(channelArgs)) { if (credentials != null) { using (CredentialsSafeHandle nativeCredentials = credentials.ToNativeCredentials()) { this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs); } } else { this.handle = ChannelSafeHandle.Create(target, nativeChannelArgs); } } this.target = GetOverridenTarget(target, channelArgs); }
/// <summary> /// Creates a channel. /// </summary> public Channel(string target, Credentials credentials = null, ChannelArgs channelArgs = null) { using (ChannelArgsSafeHandle nativeChannelArgs = CreateNativeChannelArgs(channelArgs)) { if (credentials != null) { using (CredentialsSafeHandle nativeCredentials = credentials.ToNativeCredentials()) { this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs); } } else { this.handle = ChannelSafeHandle.Create(target, nativeChannelArgs); } } this.target = GetOverridenTarget(target, channelArgs); }
private static string GetOverridenTarget(string target, ChannelArgs args) { if (args != null && !string.IsNullOrEmpty(args.GetSslTargetNameOverride())) { return args.GetSslTargetNameOverride(); } return target; }
private static ChannelArgsSafeHandle CreateNativeChannelArgs(ChannelArgs args) { if (args == null) { return ChannelArgsSafeHandle.CreateNull(); } return args.ToNativeChannelArgs(); }