Skip to content

Commit

Permalink
Fix exception at roscore startup if python has ipv6 disabled.
Browse files Browse the repository at this point in the history
Admittedly a python bug, but the workaround is already present in other parts of this file.
  • Loading branch information
aballier authored and dirk-thomas committed Dec 10, 2014
1 parent b7789b7 commit 2926581
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/rosgraph/src/rosgraph/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def is_local_address(hostname):
:returns True: if hostname maps to a local address, False otherwise. False conditions include invalid hostnames.
"""
try:
reverse_ips = [host[4][0] for host in socket.getaddrinfo(hostname, 0, 0, 0, socket.SOL_TCP)]
if use_ipv6():
reverse_ips = [host[4][0] for host in socket.getaddrinfo(socket.gethostname(), 0, 0, 0, socket.SOL_TCP)]
else:
reverse_ips = [host[4][0] for host in socket.getaddrinfo(socket.gethostname(), 0, socket.AF_INET, 0, socket.SOL_TCP)]
except socket.error:
return False
local_addresses = ['localhost'] + get_local_addresses()
Expand Down

0 comments on commit 2926581

Please sign in to comment.