2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 11:32:59 +00:00

ConnectionStatus

This commit is contained in:
Esiur Project 2022-08-14 21:54:51 +03:00
parent f4d5eb0fdd
commit 2f379732ae
3 changed files with 27 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<Copyright>Ahmed Kh. Zamil</Copyright>
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.2.6.2</Version>
<Version>2.2.7</Version>
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
<Authors>Ahmed Kh. Zamil</Authors>
<AssemblyVersion></AssemblyVersion>

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Net.IIP
{
public enum ConnectionStatus
{
Closed,
Connecting,
Connected
}
}

View File

@ -111,6 +111,9 @@ public partial class DistributedConnection : NetworkConnection, IStore
/// </summary>
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<bool>();
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;
}
/*