Transit: properly virtualize reactor in _build_listener
This commit is contained in:
parent
0c43499850
commit
aead249576
|
@ -10,7 +10,6 @@ from collections import deque
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from nacl.secret import SecretBox
|
from nacl.secret import SecretBox
|
||||||
import twisted.internet
|
|
||||||
from twisted.internet import (address, defer, endpoints, error, interfaces,
|
from twisted.internet import (address, defer, endpoints, error, interfaces,
|
||||||
protocol, task)
|
protocol, task)
|
||||||
from twisted.internet.defer import inlineCallbacks, returnValue
|
from twisted.internet.defer import inlineCallbacks, returnValue
|
||||||
|
@ -581,7 +580,7 @@ class Common:
|
||||||
self._listener = None
|
self._listener = None
|
||||||
self._winner = None
|
self._winner = None
|
||||||
if reactor is None:
|
if reactor is None:
|
||||||
reactor = twisted.internet.reactor
|
from twisted.internet import reactor
|
||||||
self._reactor = reactor
|
self._reactor = reactor
|
||||||
self._timing = timing or DebugTiming()
|
self._timing = timing or DebugTiming()
|
||||||
self._timing.add("transit")
|
self._timing.add("transit")
|
||||||
|
@ -599,7 +598,7 @@ class Common:
|
||||||
direct_hints = [
|
direct_hints = [
|
||||||
DirectTCPV1Hint(six.u(addr), portnum, 0.0) for addr in addresses
|
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
|
return direct_hints, ep
|
||||||
|
|
||||||
def get_connection_abilities(self):
|
def get_connection_abilities(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user