rename _manuallyClosed to _manuallyDisconnected
This commit is contained in:
@@ -108,7 +108,9 @@ class WebSocket {
|
||||
WebSocketChannel _channel;
|
||||
Timer _healthCheck, _reconnectionMonitor;
|
||||
DateTime _lastEventAt;
|
||||
bool _manuallyClosed = false, _connecting = false, _reconnecting = false;
|
||||
bool _manuallyDisconnected = false,
|
||||
_connecting = false,
|
||||
_reconnecting = false;
|
||||
|
||||
Event _decodeEvent(String source) {
|
||||
return Event.fromJson(json.decode(source));
|
||||
@@ -118,7 +120,7 @@ class WebSocket {
|
||||
|
||||
/// Connect the WS using the parameters passed in the constructor
|
||||
Future<Event> connect() {
|
||||
_manuallyClosed = false;
|
||||
_manuallyDisconnected = false;
|
||||
|
||||
if (_connecting) {
|
||||
logger.severe('already connecting');
|
||||
@@ -151,7 +153,7 @@ class WebSocket {
|
||||
|
||||
void _onDone() {
|
||||
_connecting = false;
|
||||
if (_manuallyClosed) {
|
||||
if (_manuallyDisconnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -290,14 +292,14 @@ class WebSocket {
|
||||
|
||||
/// Disconnects the WS and releases eventual resources
|
||||
Future<void> disconnect() async {
|
||||
if (_manuallyClosed) {
|
||||
if (_manuallyDisconnected) {
|
||||
return;
|
||||
}
|
||||
logger.info('disconnecting');
|
||||
_connectionCompleter = Completer();
|
||||
_cancelTimers();
|
||||
_reconnecting = false;
|
||||
_manuallyClosed = true;
|
||||
_manuallyDisconnected = true;
|
||||
connectionStatus.value = ConnectionStatus.disconnected;
|
||||
connectionStatus.dispose();
|
||||
return _channel.sink.close();
|
||||
|
||||
Reference in New Issue
Block a user