WIP: start replacing ServerBase with imported server
doesn't work yet at all
This commit is contained in:
parent
77201966b4
commit
9957044a99
|
@ -6,7 +6,8 @@ from click.testing import CliRunner
|
||||||
import mock
|
import mock
|
||||||
from ..cli import cli
|
from ..cli import cli
|
||||||
from ..transit import allocate_tcp_port
|
from ..transit import allocate_tcp_port
|
||||||
from ..server.server import RelayServer
|
from wormhole_mailbox_server.server import make_server
|
||||||
|
from wormhole_mailbox_server.database import create_channel_db
|
||||||
from wormhole_transit_relay.transit_server import Transit
|
from wormhole_transit_relay.transit_server import Transit
|
||||||
|
|
||||||
class ServerBase:
|
class ServerBase:
|
||||||
|
@ -16,17 +17,20 @@ class ServerBase:
|
||||||
def _setup_relay(self, error, advertise_version=None):
|
def _setup_relay(self, error, advertise_version=None):
|
||||||
self.sp = service.MultiService()
|
self.sp = service.MultiService()
|
||||||
self.sp.startService()
|
self.sp.startService()
|
||||||
self.relayport = allocate_tcp_port()
|
|
||||||
# need to talk to twisted team about only using unicode in
|
# need to talk to twisted team about only using unicode in
|
||||||
# endpoints.serverFromString
|
# endpoints.serverFromString
|
||||||
s = RelayServer("tcp:%d:interface=127.0.0.1" % self.relayport,
|
db = create_channel_db(":memory:")
|
||||||
advertise_version=advertise_version,
|
self._rendezvous = make_server(db,
|
||||||
signal_error=error)
|
advertise_version=advertise_version,
|
||||||
|
signal_error=error)
|
||||||
|
ep = endpoints.TCP4ServerEndpoint(reactor 0, interface="127.0.01")
|
||||||
|
site = make_web_server(self._rendezvous)
|
||||||
|
s = StreamServerEndpointService(ep, site)
|
||||||
s.setServiceParent(self.sp)
|
s.setServiceParent(self.sp)
|
||||||
|
self.rdv_ws_port = s.__lp.getHost().port
|
||||||
self._relay_server = s
|
self._relay_server = s
|
||||||
self._rendezvous = s._rendezvous
|
#self._rendezvous = s._rendezvous
|
||||||
self.relayurl = u"ws://127.0.0.1:%d/v1" % self.relayport
|
self.relayurl = u"ws://127.0.0.1:%d/v1" % self.rdv_ws_port
|
||||||
self.rdv_ws_port = self.relayport
|
|
||||||
# ws://127.0.0.1:%d/wormhole-relay/ws
|
# ws://127.0.0.1:%d/wormhole-relay/ws
|
||||||
|
|
||||||
self.transitport = allocate_tcp_port()
|
self.transitport = allocate_tcp_port()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user