2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2025-05-06 12:02:57 +00:00

Connection Status

This commit is contained in:
Esiur Project 2022-08-14 21:53:53 +03:00
parent 51ecac1c55
commit 3dcf653e4d
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,5 @@
enum ConnectionStatus{
Closed,
Connecting,
Connected
}

View File

@ -25,6 +25,7 @@ SOFTWARE.
import 'dart:async';
import 'package:collection/collection.dart';
import 'ConnectionStatus.dart';
import '../../Data/IntType.dart';
@ -279,7 +280,10 @@ class DistributedConnection extends NetworkConnection with IStore {
if (_openReply != null)
throw AsyncException(ErrorType.Exception, 0, "Connection in progress");
status = ConnectionStatus.Connecting;
_openReply = new AsyncReply<bool>();
//print("_openReply hash ${_openReply.hashCode}");
if (hostname != null) {
@ -339,6 +343,7 @@ class DistributedConnection extends NetworkConnection with IStore {
// clean up
_ready = false;
_readyToEstablish = false;
status = ConnectionStatus.Closed;
//print("Disconnected ..");
@ -1062,6 +1067,7 @@ class DistributedConnection extends NetworkConnection with IStore {
..done();
_ready = true;
status = ConnectionStatus.Connected;
_openReply?.trigger(true);
_openReply = null;
@ -1128,6 +1134,7 @@ class DistributedConnection extends NetworkConnection with IStore {
_session?.id = _authPacket.sessionId;
_ready = true;
status = ConnectionStatus.Connected;
_openReply?.trigger(true);
_openReply = null;
@ -3150,6 +3157,8 @@ class DistributedConnection extends NetworkConnection with IStore {
..done();
}
ConnectionStatus status = ConnectionStatus.Closed;
@override
getProperty(String name) => null;