diff --git a/Esiur/Esiur.csproj b/Esiur/Esiur.csproj index 5e20dd8..b878e8f 100644 --- a/Esiur/Esiur.csproj +++ b/Esiur/Esiur.csproj @@ -6,7 +6,7 @@ Ahmed Kh. Zamil http://www.esiur.com true - 2.2.6.2 + 2.2.7 https://github.com/esiur/esiur-dotnet Ahmed Kh. Zamil diff --git a/Esiur/Net/IIP/ConnectionStatus.cs b/Esiur/Net/IIP/ConnectionStatus.cs new file mode 100644 index 0000000..e9f1819 --- /dev/null +++ b/Esiur/Net/IIP/ConnectionStatus.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Esiur.Net.IIP +{ + public enum ConnectionStatus + { + Closed, + Connecting, + Connected + } + +} diff --git a/Esiur/Net/IIP/DistributedConnection.cs b/Esiur/Net/IIP/DistributedConnection.cs index 3d2352f..b2ca850 100644 --- a/Esiur/Net/IIP/DistributedConnection.cs +++ b/Esiur/Net/IIP/DistributedConnection.cs @@ -111,6 +111,9 @@ public partial class DistributedConnection : NetworkConnection, IStore /// public DistributedServer Server { get; internal set; } + + [Public] public virtual ConnectionStatus Status { get; set; } + public bool Remove(IResource resource) { // nothing to do @@ -1012,6 +1015,7 @@ public partial class DistributedConnection : NetworkConnection, IStore Warehouse.Put(this.RemoteUsername, this, null, Server).Then(x => { ready = true; + Status = ConnectionStatus.Connected; openReply?.Trigger(true); openReply = null; OnReady?.Invoke(this); @@ -1029,6 +1033,8 @@ public partial class DistributedConnection : NetworkConnection, IStore else { ready = true; + Status = ConnectionStatus.Connected; + openReply?.Trigger(true); openReply = null; @@ -1123,6 +1129,8 @@ public partial class DistributedConnection : NetworkConnection, IStore session.Id = authPacket.SessionId; ready = true; + Status = ConnectionStatus.Connected; + // put it in the warehouse if (this.Instance == null) @@ -1277,6 +1285,8 @@ public partial class DistributedConnection : NetworkConnection, IStore if (openReply != null) throw new AsyncException(ErrorType.Exception, 0, "Connection in progress"); + Status = ConnectionStatus.Connecting; + openReply = new AsyncReply(); if (hostname != null) @@ -1485,7 +1495,9 @@ public partial class DistributedConnection : NetworkConnection, IStore protected override void Disconencted() { // clean up + ready = false; readyToEstablish = false; + Status = ConnectionStatus.Closed; keepAliveTimer.Stop(); @@ -1566,7 +1578,6 @@ public partial class DistributedConnection : NetworkConnection, IStore attachedResources.Clear(); - ready = false; } /*