Commit 2855c627 authored by Nick Craver's avatar Nick Craver

Cleanup: ClientInfo

parent 40ed8d7b
......@@ -50,15 +50,7 @@ public sealed class ClientInfo
/// <summary>
/// The host of the client (typically an IP address)
/// </summary>
public string Host
{
get
{
string host;
int port;
return Format.TryGetHostPort(Address, out host, out port) ? host : null;
}
}
public string Host => Format.TryGetHostPort(Address, out string host, out _) ? host : null;
/// <summary>
/// idle time of the connection in seconds
......@@ -83,15 +75,8 @@ public string Host
/// <summary>
/// The port of the client
/// </summary>
public int Port
{
get
{
string host;
int port;
return Format.TryGetHostPort(Address, out host, out port) ? port : 0;
}
}
public int Port => Format.TryGetHostPort(Address, out _, out int port) ? port : 0;
/// <summary>
/// The raw content from redis
/// </summary>
......@@ -144,8 +129,10 @@ internal static ClientInfo[] Parse(string input)
string line;
while ((line = reader.ReadLine()) != null)
{
var client = new ClientInfo();
client.Raw = line;
var client = new ClientInfo
{
Raw = line
};
string[] tokens = line.Split(StringSplits.Space);
for (int i = 0; i < tokens.Length; i++)
{
......@@ -189,7 +176,7 @@ internal static ClientInfo[] Parse(string input)
return clients.ToArray();
}
static void AddFlag(ref ClientFlags value, string raw, ClientFlags toAdd, char token)
private static void AddFlag(ref ClientFlags value, string raw, ClientFlags toAdd, char token)
{
if (raw.IndexOf(token) >= 0) value |= toAdd;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment