diff --git a/gajim/common/connection.py b/gajim/common/connection.py index ccff8c924..cab939ca5 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -675,6 +675,7 @@ class Connection(CommonConnection, ConnectionHandlers): def _disconnect(self): log.info('Set state disconnected') + self.get_module('Ping').remove_timeout() self.connected = 0 self.disable_reconnect_timer() diff --git a/gajim/common/modules/ping.py b/gajim/common/modules/ping.py index 9a9aeb2c8..7d30ae095 100644 --- a/gajim/common/modules/ping.py +++ b/gajim/common/modules/ping.py @@ -66,10 +66,8 @@ class Ping: self.remove_timeout() def _reconnect(self) -> None: - if not app.config.get_per('accounts', self._account, 'active'): - # Account may have been disabled + if not app.account_is_connected(self._account): return - # We haven't got the pong in time, disco and reconnect log.warning('No reply received for keepalive ping. Reconnecting...') self._con.disconnect(immediately=True)