From e42d651d7ed56375523f91076295fc5f388a8de0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 19 Sep 2015 15:27:12 +0200 Subject: Fix connecting to a custom host/port --- slixmpp/xmlstream/xmlstream.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 90afd749..28bfb17c 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -288,19 +288,14 @@ class XMLStream(asyncio.BaseProtocol): self.event_when_connected = "connected" record = yield from self.pick_dns_answer(self.default_domain) - if record is None: - # No more DNS records to try - self.dns_answers = None - return + if record is not None: + host, address, port = record + self.address = (address, port) + self._service_name = host else: - if record: - host, address, port = record - self.address = (address, port) - self._service_name = host - else: - # No DNS records left, stop iterating - # and try (host, port) as a last resort - self.dns_answers = None + # No DNS records left, stop iterating + # and try (host, port) as a last resort + self.dns_answers = None yield from asyncio.sleep(self.connect_loop_wait) try: -- cgit v1.2.3