transit: allow 127.0.0.1 if that's all we've got
The appveyor tests were failing because their VMs only have 127.0.0.1, and stripping it out resulted in an empty hint list, which meant Transit couldn't work at all.
This commit is contained in:
parent
55f2fcc3a7
commit
682fe0ae2c
|
@ -597,8 +597,14 @@ class Common:
|
||||||
if self._no_listen or self._tor_manager:
|
if self._no_listen or self._tor_manager:
|
||||||
return ([], None)
|
return ([], None)
|
||||||
portnum = allocate_tcp_port()
|
portnum = allocate_tcp_port()
|
||||||
|
addresses = ipaddrs.find_addresses()
|
||||||
|
non_loopback_addresses = [a for a in addresses if a != "127.0.0.1"]
|
||||||
|
if non_loopback_addresses:
|
||||||
|
# some test hosts, including the appveyor VMs, *only* have
|
||||||
|
# 127.0.0.1, and the tests will hang badly if we remove it.
|
||||||
|
addresses = non_loopback_addresses
|
||||||
direct_hints = [DirectTCPV1Hint(six.u(addr), portnum)
|
direct_hints = [DirectTCPV1Hint(six.u(addr), portnum)
|
||||||
for addr in ipaddrs.find_addresses()]
|
for addr in addresses]
|
||||||
ep = endpoints.serverFromString(reactor, "tcp:%d" % portnum)
|
ep = endpoints.serverFromString(reactor, "tcp:%d" % portnum)
|
||||||
return direct_hints, ep
|
return direct_hints, ep
|
||||||
|
|
||||||
|
@ -612,7 +618,6 @@ class Common:
|
||||||
hints = []
|
hints = []
|
||||||
direct_hints = yield self._get_direct_hints()
|
direct_hints = yield self._get_direct_hints()
|
||||||
for dh in direct_hints:
|
for dh in direct_hints:
|
||||||
if dh.hostname != '127.0.0.1':
|
|
||||||
hints.append({u"type": u"direct-tcp-v1",
|
hints.append({u"type": u"direct-tcp-v1",
|
||||||
u"hostname": dh.hostname,
|
u"hostname": dh.hostname,
|
||||||
u"port": dh.port, # integer
|
u"port": dh.port, # integer
|
||||||
|
|
Loading…
Reference in New Issue
Block a user