Author: asterix Date: 2008-06-19 20:05:15 +0200 (Thu, 19 Jun 2008) New Revision: 9824
Modified: trunk/src/common/connection.py Log: when we are disconnected from server, we then try to reconnect only with the type (tls, ssl, plain) that worked first time. Fixes #3896
Modified: trunk/src/common/connection.py =================================================================== --- trunk/src/common/connection.py 2008-06-19 12:56:45 UTC (rev 9823) +++ trunk/src/common/connection.py 2008-06-19 18:05:15 UTC (rev 9824) @@ -103,6 +103,9 @@ self.connection = None # xmpppy ClientCommon instance # this property is used to prevent double connections self.last_connection = None # last ClientCommon instance + # If we succeed to connect, remember it so next time we try (after a + # disconnection) we try only this type. + self.last_connection_type = None self.lang = None if locale.getdefaultlocale()[0]: self.lang = locale.getdefaultlocale()[0].split('_')[0] @@ -556,7 +559,9 @@ def connect_to_next_host(self, retry = False): if len(self._hosts): # No config option exist when creating a new account - if self.name in gajim.config.get_per('accounts'): + if self.last_connection_type: + self._connection_types = [self.last_connection_type] + elif self.name in gajim.config.get_per('accounts'): self._connection_types = gajim.config.get_per('accounts', self.name, 'connection_types').split() else: @@ -615,6 +620,7 @@ log.debug('Connected to server %s:%s with %s' % ( self._current_host['host'], self._current_host['port'], con_type))
+ self.last_connection_type = con_type name = gajim.config.get_per('accounts', self.name, 'name') hostname = gajim.config.get_per('accounts', self.name, 'hostname') self.connection = con