8000 Merge pull request #197 from IcoDeveloper/DNSEndpoint-Support-for-Sta… · cnblogs/EnyimMemcachedCore@badded1 · GitHub
[go: up one dir, main page]

Skip to content

Commit badded1

Browse files
authored
Merge pull request #197 from IcoDeveloper/DNSEndpoint-Support-for-Statistics
Allow DNSEndpoints in Server Stats
2 parents 78f8563 + 5fea087 commit badded1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Enyim.Caching/Memcached/ServerStats.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public sealed class ServerStats
1616
/// <summary>
1717
/// Defines a value which indicates that the statstics should be retrieved for all servers in the pool.
1818
/// </summary>
19-
public static readonly EndPoint All = new IPEndPoint(IPAddress.Any, 0);
19+
public static readonly IPEndPoint All = new IPEndPoint(IPAddress.Any, 0);
2020
#region [ readonly int[] Optable ]
2121
// defines which values can be summed and which not
2222
private static readonly int[] Optable =
@@ -60,10 +60,10 @@ internal ServerStats(Dictionary<EndPoint, Dictionary<string, string>> results)
6060
/// <param name="server">The adress of the server. If <see cref="IPAddress.Any"/> is specified it will return the sum of all server stat values.</param>
6161
/// <param name="item">The stat to be returned</param>
6262
/// <returns>The value of the specified stat item</returns>
63-
public long GetValue(IPEndPoint server, StatItem item)
63+
public long GetValue(EndPoint server, StatItem item)
6464
{
6565
// asked for a specific server
66-
if (server.Address != IPAddress.Any)
66+
if (server is not IPEndPoint || ((IPEndPoint)server).Address != IPAddress.Any)
6767
{
6868
// error check
6969
string tmp = GetRaw(server, item);
@@ -85,7 +85,7 @@ public long GetValue(IPEndPoint server, StatItem item)
8585
long retval = 0;
8686

8787
// sum & return
88-
foreach (IPEndPoint ep in _results.Keys)
88+
foreach (EndPoint ep in _results.Keys)
8989
{
9090
retval += GetValue(ep, item);
9191
}
@@ -98,7 +98,7 @@ public long GetValue(IPEndPoint server, StatItem item)
9898
/// </summary>
9999
/// <param name="server">The adress of the server</param>
100100
/// <returns>The version of memcached</returns>
101-
public Version GetVersion(IPEndPoint server)
101+
public Version GetVersion(EndPoint server)
102102
{
103103
string version = GetRaw(server, StatItem.Version);
104104
if (String.IsNullOrEmpty(version))
@@ -112,7 +112,7 @@ public Version GetVersion(IPEndPoint server)
112112
/// </summary>
113113
/// <param name="server">The adress of the server</param>
114114
/// <returns>A value indicating how long the server is running</returns>
115-
public TimeSpan GetUptime(IPEndPoint server)
115+
public TimeSpan GetUptime(EndPoint server)
116116
{
117117
string uptime = GetRaw(server, StatItem.Uptime);
118118
if (String.IsNullOrEmpty(uptime))
@@ -131,7 +131,7 @@ public TimeSpan GetUptime(IPEndPoint server)
131131
/// <param name="server">The adress of the server</param>
132132
/// <param name="key">The name of the stat value</param>
133133
/// <returns>The value of the stat item</returns>
134-
public string GetRaw(IPEndPoint server, string key)
134+
public string GetRaw(EndPoint server, string key)
135135
{
136136
Dictionary<string, string> serverValues;
137137
string retval;
@@ -159,7 +159,7 @@ public string GetRaw(IPEndPoint server, string key)
159159
/// <param name="server">The adress of the server</param>
160160
/// <param name="item">The stat value to be returned</param>
161161
/// <returns>The value of the stat item</returns>
162-
public string GetRaw(IPEndPoint server, StatItem item)
162+
public string GetRaw(EndPoint server, StatItem item)
163163
{
164164
if ((int)item < StatKeys.Length && (int)item >= 0)
165165
return GetRaw(server, StatKeys[(int)item]);

0 commit comments

Comments
 (0)
0