diff --git a/lib/service/moxxmpp/reconnect.dart b/lib/service/moxxmpp/reconnect.dart index 25feb4ed..d11eb305 100644 --- a/lib/service/moxxmpp/reconnect.dart +++ b/lib/service/moxxmpp/reconnect.dart @@ -55,16 +55,21 @@ class MoxxyReconnectionPolicy extends ReconnectionPolicy { @override Future reset() async { + _stopTimer(); await setIsReconnecting(false); } - @visibleForTesting - Future onTimerElapsed() async { + void _stopTimer() { if (timer != null) { timer!.cancel(); timer = null; _log.finest('Destroying timer'); } + } + + @visibleForTesting + Future onTimerElapsed() async { + _stopTimer(); _log.finest('Performing reconnect'); await performReconnect!();