aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Channel.cs
diff options
context:
space:
mode:
authorGravatar Robbie Shade <rjshade@google.com>2015-08-13 16:12:26 -0400
committerGravatar Robbie Shade <rjshade@google.com>2015-08-13 16:12:26 -0400
commit37ad56b469836b7d4b3e9753913e37aae3ac46c7 (patch)
treed8d3cdf9f50f66ac567523872096f2f555a13b43 /src/csharp/Grpc.Core/Channel.cs
parent98981efe0d29626645abc2ff495737a078bab021 (diff)
parent118f65dc8c5df39872aff5f6bf269b16ce82c259 (diff)
Merge remote-tracking branch 'upstream/master' into add_udp_server_2
Diffstat (limited to 'src/csharp/Grpc.Core/Channel.cs')
-rw-r--r--src/csharp/Grpc.Core/Channel.cs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs
index 9273ea4582..64c6adf2bf 100644
--- a/src/csharp/Grpc.Core/Channel.cs
+++ b/src/csharp/Grpc.Core/Channel.cs
@@ -49,6 +49,7 @@ namespace Grpc.Core
{
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<Channel>();
+ readonly string target;
readonly GrpcEnvironment environment;
readonly ChannelSafeHandle handle;
readonly List<ChannelOption> options;
@@ -58,12 +59,12 @@ namespace Grpc.Core
/// Creates a channel that connects to a specific host.
/// Port will default to 80 for an unsecure channel and to 443 for a secure channel.
/// </summary>
- /// <param name="host">The name or IP address of the host.</param>
+ /// <param name="target">Target of the channel.</param>
/// <param name="credentials">Credentials to secure the channel.</param>
/// <param name="options">Channel options.</param>
- public Channel(string host, Credentials credentials, IEnumerable<ChannelOption> options = null)
+ public Channel(string target, Credentials credentials, IEnumerable<ChannelOption> options = null)
{
- Preconditions.CheckNotNull(host);
+ this.target = Preconditions.CheckNotNull(target, "target");
this.environment = GrpcEnvironment.GetInstance();
this.options = options != null ? new List<ChannelOption>(options) : new List<ChannelOption>();
@@ -73,11 +74,11 @@ namespace Grpc.Core
{
if (nativeCredentials != null)
{
- this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, host, nativeChannelArgs);
+ this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs);
}
else
{
- this.handle = ChannelSafeHandle.CreateInsecure(host, nativeChannelArgs);
+ this.handle = ChannelSafeHandle.CreateInsecure(target, nativeChannelArgs);
}
}
}
@@ -131,8 +132,8 @@ namespace Grpc.Core
return tcs.Task;
}
- /// <summary> Address of the remote endpoint in URI format.</summary>
- public string Target
+ /// <summary>Resolved address of the remote endpoint in URI format.</summary>
+ public string ResolvedTarget
{
get
{
@@ -140,6 +141,15 @@ namespace Grpc.Core
}
}
+ /// <summary>The original target used to create the channel.</summary>
+ public string Target
+ {
+ get
+ {
+ return this.target;
+ }
+ }
+
/// <summary>
/// Allows explicitly requesting channel to connect without starting an RPC.
/// Returned task completes once state Ready was seen. If the deadline is reached,