From aead2495761ede279c3b49b1f389f35940656fed Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 6 Feb 2020 22:49:12 -0800 Subject: [PATCH] Transit: properly virtualize reactor in _build_listener --- src/wormhole/transit.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wormhole/transit.py b/src/wormhole/transit.py index 0f28e89..084b85f 100644 --- a/src/wormhole/transit.py +++ b/src/wormhole/transit.py @@ -10,7 +10,6 @@ from collections import deque import six from nacl.secret import SecretBox -import twisted.internet from twisted.internet import (address, defer, endpoints, error, interfaces, protocol, task) from twisted.internet.defer import inlineCallbacks, returnValue @@ -581,7 +580,7 @@ class Common: self._listener = None self._winner = None if reactor is None: - reactor = twisted.internet.reactor + from twisted.internet import reactor self._reactor = reactor self._timing = timing or DebugTiming() self._timing.add("transit") @@ -599,7 +598,7 @@ class Common: direct_hints = [ DirectTCPV1Hint(six.u(addr), portnum, 0.0) for addr in addresses ] - ep = endpoints.serverFromString(twisted.internet.reactor, "tcp:%d" % portnum) + ep = endpoints.serverFromString(self._reactor, "tcp:%d" % portnum) return direct_hints, ep def get_connection_abilities(self):