allow --relay-helper="" to disable relay
test_scripts now uses this to avoid accidentally using a relay
This commit is contained in:
parent
d14d35f3cd
commit
e2f3bebe38
|
@ -202,8 +202,12 @@ class RecordPipe:
|
|||
|
||||
class Common:
|
||||
def __init__(self, transit_relay):
|
||||
if not isinstance(transit_relay, type(u"")): raise UsageError
|
||||
self._transit_relay = transit_relay
|
||||
if transit_relay:
|
||||
if not isinstance(transit_relay, type(u"")):
|
||||
raise UsageError
|
||||
self._transit_relays = [transit_relay]
|
||||
else:
|
||||
self._transit_relays = []
|
||||
self.winning = threading.Event()
|
||||
self._negotiation_check_lock = threading.Lock()
|
||||
self._have_transit_key = threading.Condition()
|
||||
|
@ -224,7 +228,7 @@ class Common:
|
|||
def get_direct_hints(self):
|
||||
return self.my_direct_hints
|
||||
def get_relay_hints(self):
|
||||
return [self._transit_relay]
|
||||
return self._transit_relays
|
||||
|
||||
def add_their_direct_hints(self, hints):
|
||||
for h in hints:
|
||||
|
|
|
@ -85,7 +85,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
|||
assert mode in ("text", "file", "directory")
|
||||
wormhole = self.find_executable()
|
||||
server_args = ["--relay-url", self.relayurl,
|
||||
"--transit-helper", self.transit]
|
||||
"--transit-helper", ""]
|
||||
code = u"1-abc"
|
||||
message = "test message"
|
||||
|
||||
|
|
|
@ -403,9 +403,12 @@ class Common:
|
|||
RELAY_DELAY = 2.0
|
||||
|
||||
def __init__(self, transit_relay, reactor=reactor):
|
||||
if not isinstance(transit_relay, (type(None), type(u""))):
|
||||
raise UsageError
|
||||
self._transit_relay = transit_relay
|
||||
if transit_relay:
|
||||
if not isinstance(transit_relay, type(u"")):
|
||||
raise UsageError
|
||||
self._transit_relays = [transit_relay]
|
||||
else:
|
||||
self._transit_relays = []
|
||||
self._transit_key = None
|
||||
self._waiting_for_transit_key = []
|
||||
self._listener = None
|
||||
|
@ -459,9 +462,7 @@ class Common:
|
|||
self._listener_d.cancel()
|
||||
|
||||
def get_relay_hints(self):
|
||||
if self._transit_relay:
|
||||
return [self._transit_relay]
|
||||
return []
|
||||
return self._transit_relays
|
||||
|
||||
def add_their_direct_hints(self, hints):
|
||||
for h in hints:
|
||||
|
|
Loading…
Reference in New Issue
Block a user