diff options
author | Lance Stout <lancestout@gmail.com> | 2012-08-10 14:15:55 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-08-10 14:15:55 -0700 |
commit | 962dfad2166574955c7be6d12c930991b0f29403 (patch) | |
tree | 6a4dd01bd7668bb133814d0e099fed38ef7d08d7 /sleekxmpp/xmlstream/resolver.py | |
parent | 14aa8311690f3a58ff4b7ad286bcccdd867789f7 (diff) | |
parent | f7a710e55bf433a378dee4bd05f6ceb59f2e9e2d (diff) | |
download | slixmpp-962dfad2166574955c7be6d12c930991b0f29403.tar.gz slixmpp-962dfad2166574955c7be6d12c930991b0f29403.tar.bz2 slixmpp-962dfad2166574955c7be6d12c930991b0f29403.tar.xz slixmpp-962dfad2166574955c7be6d12c930991b0f29403.zip |
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/xmlstream/resolver.py')
-rw-r--r-- | sleekxmpp/xmlstream/resolver.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sleekxmpp/xmlstream/resolver.py b/sleekxmpp/xmlstream/resolver.py index 0d7a8c0d..394daa64 100644 --- a/sleekxmpp/xmlstream/resolver.py +++ b/sleekxmpp/xmlstream/resolver.py @@ -102,7 +102,7 @@ def resolve(host, port=None, service=None, proto='tcp', try: # If `host` is an IPv4 literal, we can return it immediately. ipv4 = socket.inet_aton(host) - yield (host, port) + yield (host, host, port) except socket.error: pass @@ -112,7 +112,7 @@ def resolve(host, port=None, service=None, proto='tcp', # it immediately. if hasattr(socket, 'inet_pton'): ipv6 = socket.inet_pton(socket.AF_INET6, host) - yield (host, port) + yield (host, host, port) except socket.error: pass @@ -128,16 +128,16 @@ def resolve(host, port=None, service=None, proto='tcp', results = [] if host == 'localhost': if use_ipv6: - results.append(('::1', port)) - results.append(('127.0.0.1', port)) + results.append((host, '::1', port)) + results.append((host, '127.0.0.1', port)) if use_ipv6: for address in get_AAAA(host, resolver=resolver): - results.append((address, port)) + results.append((host, address, port)) for address in get_A(host, resolver=resolver): - results.append((address, port)) + results.append((host, address, port)) - for address, port in results: - yield address, port + for host, address, port in results: + yield host, address, port def get_A(host, resolver=None): @@ -297,7 +297,10 @@ def get_SRV(host, port, service, proto='tcp', resolver=None): for running_sum in sums: if running_sum >= selected: rec = sums[running_sum] - sorted_recs.append((rec.target.to_text(), rec.port)) + host = rec.target.to_text() + if host.endswith('.'): + host = host[:-1] + sorted_recs.append((host, rec.port)) answers[priority].remove(rec) break |