twisted.transit: tolerate the lack of a listener
In Tor mode, there is no local listener. Eventually we'll add an Onion Service listener, but it's not guaranteed that we can run one.
This commit is contained in:
parent
8d92b40139
commit
08a5e6043a
|
@ -504,6 +504,10 @@ class Common:
|
||||||
# listener will win.
|
# listener will win.
|
||||||
self._my_direct_hints, self._listener = self._build_listener()
|
self._my_direct_hints, self._listener = self._build_listener()
|
||||||
|
|
||||||
|
if self._listener is None: # don't listen
|
||||||
|
self._listener_d = None
|
||||||
|
return defer.succeed(self._my_direct_hints) # empty
|
||||||
|
|
||||||
# Start the server, so it will be running by the time anyone tries to
|
# Start the server, so it will be running by the time anyone tries to
|
||||||
# connect to the direct hints we return.
|
# connect to the direct hints we return.
|
||||||
f = InboundConnectionFactory(self)
|
f = InboundConnectionFactory(self)
|
||||||
|
@ -617,7 +621,8 @@ class Common:
|
||||||
# have any viable direct hints, then they're either going to succeed
|
# have any viable direct hints, then they're either going to succeed
|
||||||
# quickly or hang for a long time.
|
# quickly or hang for a long time.
|
||||||
contenders = []
|
contenders = []
|
||||||
contenders.append(self._listener_d)
|
if self._listener_d:
|
||||||
|
contenders.append(self._listener_d)
|
||||||
relay_delay = 0
|
relay_delay = 0
|
||||||
|
|
||||||
for hint in self._their_direct_hints:
|
for hint in self._their_direct_hints:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user