Project

General

Profile

Bug #3428

Custom port broken (XMLStream DNS returns Incorrect Port)

Added by Anonymous 6 months ago. Updated 6 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
2018-10-03
Due date:
% Done:

0%

Estimated time:
Version:

Description

Attempting to connect to my XMPP server on port 5223. It works fine with SleekXMPP, however SliXMPP 1.4.0 hangs during the `process` call.
Increased the logging to INFO and noticed that after querying A records it attempts to connect to 5222.

DEBUG    Event triggered: connecting
DEBUG    DNS: Querying ****.************.com for AAAA records.
DEBUG    DNS: Exception while querying for ****.************.com AAAA records: (1, 'DNS server returned answer with no data')
DEBUG    DNS: Querying aws002.saltdna.com for A records.
DEBUG    Connection failed: [Errno 60] Connect call failed ('**.***.***.***', ****)
DEBUG    Event triggered: connection_failed

Looked at the code and within `xmlstream.py` at the method `_connect_routine`, I changed.

record = await self.pick_dns_answer(self.default_domain)
if record is not None:
    host, address, dns_port = record
    port = dns_port if dns_port else self.address[1]
    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

to this

record = await self.pick_dns_answer(self.default_domain, port=self.address[1])
if record is not None:
    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

And it works fine. It appears that `pick_dns_answer`, always returns a port, and so the old logic to fallback to the port specified in the address is no longer working

History

#1 Updated by louiz 6 months ago

Hello, please report issues on https://lab.louiz.org/poezio/slixmpp

I re-created your issue here: https://lab.louiz.org/poezio/slixmpp/issues/3418

(I didn’t check if it’s valid or anything, just copy-pasted without reading)

Also available in: Atom PDF