diff --git a/src/wormhole/blocking/transit.py b/src/wormhole/blocking/transit.py index 5a8e0f5..6cf4098 100644 --- a/src/wormhole/blocking/transit.py +++ b/src/wormhole/blocking/transit.py @@ -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: diff --git a/src/wormhole/test/test_scripts.py b/src/wormhole/test/test_scripts.py index 64bf5e6..646cb03 100644 --- a/src/wormhole/test/test_scripts.py +++ b/src/wormhole/test/test_scripts.py @@ -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" diff --git a/src/wormhole/twisted/transit.py b/src/wormhole/twisted/transit.py index 6830f8e..fc3fea5 100644 --- a/src/wormhole/twisted/transit.py +++ b/src/wormhole/twisted/transit.py @@ -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: