fix(llc): fix connecting while connecting and disconneting (#1237)

* fix(llc): fix connecting while connecting and disconneting

* chore(llc): update changelog

* chore(llc): add test

* chore(llc): improve test

* fix(llc): _resetRequestFlags regardless of the connection status
This commit is contained in:
Salvatore Giordano
2022-07-05 12:08:08 +02:00
committed by GitHub
parent d2883c87f0
commit a37bf2bde4
3 changed files with 44 additions and 0 deletions
@@ -436,6 +436,9 @@ class WebSocket with TimerHelper {
/// Disconnects the WS and releases eventual resources
void disconnect() {
if (connectionStatus == ConnectionStatus.disconnected) return;
_resetRequestFlags(resetAttempts: true);
_connectionStatus = ConnectionStatus.disconnected;
_logger?.info('Disconnecting web-socket connection');
@@ -447,6 +450,7 @@ class WebSocket with TimerHelper {
_stopMonitoringEvents();
_manuallyClosed = true;
_closeWebSocketChannel();
}
}