summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-09-19 15:27:12 +0200
committermathieui <mathieui@mathieui.net>2015-09-19 15:27:12 +0200
commite42d651d7ed56375523f91076295fc5f388a8de0 (patch)
tree819fcd613ba534070fd08635e4fed8484547e583
parent82e549c0e9b6c0d5a8302c4072039512fef84e31 (diff)
downloadslixmpp-e42d651d7ed56375523f91076295fc5f388a8de0.tar.gz
slixmpp-e42d651d7ed56375523f91076295fc5f388a8de0.tar.bz2
slixmpp-e42d651d7ed56375523f91076295fc5f388a8de0.tar.xz
slixmpp-e42d651d7ed56375523f91076295fc5f388a8de0.zip
Fix connecting to a custom host/port
-rw-r--r--slixmpp/xmlstream/xmlstream.py19
1 files 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: