From e422a1807d8f7086ee25ee0cf9bccda27109a562 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 7 Nov 2005 14:04:18 +0000 Subject: [PATCH] SRV now works (hopefully !) we use a new Client instance for each try fix a typo in the use of pydns --- src/common/connection.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index 868c539c1..eef23d3dd 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1486,13 +1486,6 @@ class Connection: proxy['password'] = gajim.config.get_per('proxies', p, 'pass') else: proxy = None - if gajim.verbose: - con = common.xmpp.Client(hostname, caller = self) - else: - con = common.xmpp.Client(hostname, debug = [], caller = self) - common.xmpp.dispatcher.DefaultTimeout = try_connecting_for_foo_secs - con.UnregisterDisconnectHandler(con.DisconnectHandler) - con.RegisterDisconnectHandler(self._disconnectedReconnCB) h = hostname p = 5222 @@ -1529,7 +1522,7 @@ class Connection: if len(answers) > 0: # ignore the priority and weight for now for a in answers: - prio, weight, port, host = answers[0]['data'] + prio, weight, port, host = a['data'] hosts.append({'host': host, 'port': port, 'prio': prio, @@ -1544,6 +1537,13 @@ class Connection: con_type = None while len(hosts) and not con_type: + if gajim.verbose: + con = common.xmpp.Client(hostname, caller = self) + else: + con = common.xmpp.Client(hostname, debug = [], caller = self) + common.xmpp.dispatcher.DefaultTimeout = try_connecting_for_foo_secs + con.UnregisterDisconnectHandler(con.DisconnectHandler) + host = self.select_next_host(hosts) hosts.remove(host) con_type = con.connect((host['host'], host['port']), proxy = proxy, @@ -1561,6 +1561,7 @@ class Connection: _('Check your connection or try again later.'))) return None, '' + con.RegisterDisconnectHandler(self._disconnectedReconnCB) gajim.log.debug(_('Connected to server %s:%s with %s') % (host['host'], host['port'], con_type)) return con, con_type