once we are connected to a server with starttls, don't try to connect with the legacy port

This commit is contained in:
Yann Leboulanger 2015-11-22 20:10:33 +01:00
parent 70865447b2
commit e2c1e96685

View file

@ -1215,7 +1215,7 @@ class Connection(CommonConnection, ConnectionHandlers):
self._connection_types = gajim.config.get_per('accounts', self.name, self._connection_types = gajim.config.get_per('accounts', self.name,
'connection_types').split() 'connection_types').split()
else: else:
self._connection_types = ['tls', 'ssl', 'plain'] self._connection_types = ['tls', 'ssl']
if self.last_connection_type: if self.last_connection_type:
if self.last_connection_type in self._connection_types: if self.last_connection_type in self._connection_types:
self._connection_types.remove(self.last_connection_type) self._connection_types.remove(self.last_connection_type)
@ -1420,6 +1420,14 @@ class Connection(CommonConnection, ConnectionHandlers):
self._current_host['host'], self._current_host['port'], con_type)) self._current_host['host'], self._current_host['port'], con_type))
self.last_connection_type = con_type self.last_connection_type = con_type
if con_type == 'tls' and 'ssl' in self._connection_types:
# we were about to try ssl after tls, but tls succeed, so
# definitively stop trying ssl
con_types = gajim.config.get_per('accounts', self.name,
'connection_types').split()
con_types.remove('ssl')
gajim.config.set_per('accounts', self.name, 'connection_types',
' '.join(con_types))
if gajim.config.get_per('accounts', self.name, 'anonymous_auth'): if gajim.config.get_per('accounts', self.name, 'anonymous_auth'):
name = None name = None
else: else: