xmpp: Expect socket closure on reconnection

This commit is contained in:
PapaTutuWawa 2022-08-04 12:13:58 +02:00
parent 236de4c37f
commit ee2ca8d444

View File

@ -334,7 +334,15 @@ class XmppConnection {
/// Attempts to reconnect to the server by following an exponential backoff. /// Attempts to reconnect to the server by following an exponential backoff.
void _attemptReconnection() { void _attemptReconnection() {
_setConnectionState(XmppConnectionState.notConnected); _setConnectionState(XmppConnectionState.notConnected);
// Prevent the reconnection triggering another reconnection
_expectSocketClosure = true;
_socket.close(); _socket.close();
// Reset the state
_expectSocketClosure = false;
// Connect again
connect(); connect();
} }