Commit 2bc189cc authored by Richard Tappenden's avatar Richard Tappenden Committed by Nick Craver

Isconnecting (#803)

* Add IsConnecting property to determine whether the multiplexor is trying to establish a connection.
* spaces
* Use the correct enum to determine 'IsConnecting'
parent 9f4dea47
...@@ -1839,6 +1839,20 @@ public bool IsConnected ...@@ -1839,6 +1839,20 @@ public bool IsConnected
} }
} }
/// <summary>
/// Indicates whether any servers are currently trying to connect
/// </summary>
public bool IsConnecting
{
get
{
var tmp = serverSnapshot;
for (int i = 0; i < tmp.Length; i++)
if (tmp[i].IsConnecting) return true;
return false;
}
}
internal ConfigurationOptions RawConfig => configuration; internal ConfigurationOptions RawConfig => configuration;
internal ServerSelectionStrategy ServerSelectionStrategy => serverSelectionStrategy; internal ServerSelectionStrategy ServerSelectionStrategy => serverSelectionStrategy;
......
...@@ -51,6 +51,11 @@ public interface IConnectionMultiplexer ...@@ -51,6 +51,11 @@ public interface IConnectionMultiplexer
/// </summary> /// </summary>
bool IsConnected { get; } bool IsConnected { get; }
/// <summary>
/// Indicates whether any servers are connected
/// </summary>
bool IsConnecting { get; }
/// <summary> /// <summary>
/// Should exceptions include identifiable details? (key names, additional .Data annotations) /// Should exceptions include identifiable details? (key names, additional .Data annotations)
/// </summary> /// </summary>
......
...@@ -70,6 +70,8 @@ public enum State : byte ...@@ -70,6 +70,8 @@ public enum State : byte
public bool IsConnected => state == (int)State.ConnectedEstablished; public bool IsConnected => state == (int)State.ConnectedEstablished;
public bool IsConnecting => state == (int)State.ConnectedEstablishing || state == (int)State.Connecting;
public ConnectionMultiplexer Multiplexer { get; } public ConnectionMultiplexer Multiplexer { get; }
public ServerEndPoint ServerEndPoint { get; } public ServerEndPoint ServerEndPoint { get; }
......
...@@ -77,6 +77,8 @@ public ServerEndPoint(ConnectionMultiplexer multiplexer, EndPoint endpoint, Text ...@@ -77,6 +77,8 @@ public ServerEndPoint(ConnectionMultiplexer multiplexer, EndPoint endpoint, Text
public bool IsConnected => interactive?.IsConnected == true; public bool IsConnected => interactive?.IsConnected == true;
public bool IsConnecting => interactive?.IsConnecting == true;
internal Exception LastException internal Exception LastException
{ {
get get
......
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