diff --git a/src/common/connection.py b/src/common/connection.py index 7b6043500..b4469b930 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1420,6 +1420,8 @@ class Connection: # end of SRV resolver con_type = con.connect((h, p), proxy=proxy, secure=secur) + if not self.connected: # We went offline during connecting process + return None if not con_type: gajim.log.debug("Couldn't connect to %s" % self.name) if not self.retrycount: @@ -1486,6 +1488,8 @@ class Connection: self.dispatch('ERROR', (_('Could not connect to "%s"') % self.name, _('Check your connection or try again later'))) return None + if not self.connected: # We went offline during connecting process + return None if hasattr(con, 'Resource'): self.server_resource = con.Resource con.RegisterEventHandler(self._event_dispatcher)