commit
3f05cd3007
|
@ -163,6 +163,17 @@ class Basic(unittest.TestCase):
|
|||
self.assertEqual(c._their_direct_hints, [])
|
||||
self.assertEqual(c._their_relay_hints, [])
|
||||
|
||||
def test_ignore_localhost_hint(self):
|
||||
# this actually starts the listener
|
||||
c = transit.TransitSender(u"")
|
||||
results = []
|
||||
d = c.get_connection_hints()
|
||||
d.addBoth(results.append)
|
||||
hints = results[0]
|
||||
c._stop_listening()
|
||||
for hint in hints:
|
||||
self.assertFalse(hint[u'hostname'] == u'127.0.0.1')
|
||||
|
||||
def test_transit_key_wait(self):
|
||||
KEY = b"123"
|
||||
c = transit.Common(u"")
|
||||
|
|
|
@ -597,8 +597,14 @@ class Common:
|
|||
if self._no_listen or self._tor_manager:
|
||||
return ([], None)
|
||||
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)
|
||||
for addr in ipaddrs.find_addresses()]
|
||||
for addr in addresses]
|
||||
ep = endpoints.serverFromString(reactor, "tcp:%d" % portnum)
|
||||
return direct_hints, ep
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user