mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:01:33 +00:00
Move ZMQ bind address logging to TFWServer
This commit is contained in:
parent
96c6c9b358
commit
38eec06b4d
@ -18,7 +18,6 @@ class ZMQDownlinkListener:
|
|||||||
self._zmq_pull_socket.setsockopt(zmq.RCVHWM, 0)
|
self._zmq_pull_socket.setsockopt(zmq.RCVHWM, 0)
|
||||||
self._zmq_pull_socket.bind(bind_addr)
|
self._zmq_pull_socket.bind(bind_addr)
|
||||||
self._zmq_pull_stream = ZMQStream(self._zmq_pull_socket)
|
self._zmq_pull_stream = ZMQStream(self._zmq_pull_socket)
|
||||||
LOG.debug('Pull socket bound to %s', bind_addr)
|
|
||||||
|
|
||||||
def register_callback(self, callback):
|
def register_callback(self, callback):
|
||||||
callback = with_deserialize_tfw_msg(callback) if callback else None
|
callback = with_deserialize_tfw_msg(callback) if callback else None
|
||||||
@ -42,7 +41,6 @@ class ZMQUplinkListener:
|
|||||||
self._zmq_pub_socket = zmq.Context.instance().socket(zmq.PUB)
|
self._zmq_pub_socket = zmq.Context.instance().socket(zmq.PUB)
|
||||||
self._zmq_pub_socket.setsockopt(zmq.SNDHWM, 0)
|
self._zmq_pub_socket.setsockopt(zmq.SNDHWM, 0)
|
||||||
self._zmq_pub_socket.bind(bind_addr)
|
self._zmq_pub_socket.bind(bind_addr)
|
||||||
LOG.debug('Pub socket bound to %s', bind_addr)
|
|
||||||
|
|
||||||
def send_message(self, message: dict):
|
def send_message(self, message: dict):
|
||||||
self._zmq_pub_socket.send_multipart(serialize_tfw_msg(message))
|
self._zmq_pub_socket.send_multipart(serialize_tfw_msg(message))
|
||||||
|
@ -16,10 +16,14 @@ class TFWServer:
|
|||||||
SUB socket.
|
SUB socket.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._listener = ZMQListener(
|
downlink_bind_addr = f'tcp://*:{TFWENV.PULL_PORT}'
|
||||||
downlink_bind_addr=f'tcp://*:{TFWENV.PULL_PORT}',
|
|
||||||
uplink_bind_addr = f'tcp://*:{TFWENV.PUB_PORT}'
|
uplink_bind_addr = f'tcp://*:{TFWENV.PUB_PORT}'
|
||||||
|
self._listener = ZMQListener(
|
||||||
|
downlink_bind_addr=downlink_bind_addr,
|
||||||
|
uplink_bind_addr=uplink_bind_addr
|
||||||
)
|
)
|
||||||
|
LOG.debug('Pull socket bound to %s', downlink_bind_addr)
|
||||||
|
LOG.debug('Pub socket bound to %s', uplink_bind_addr)
|
||||||
self.application = Application([(
|
self.application = Application([(
|
||||||
r'/ws', ZMQWebSocketRouter, {
|
r'/ws', ZMQWebSocketRouter, {
|
||||||
'listener': self._listener,
|
'listener': self._listener,
|
||||||
|
Loading…
Reference in New Issue
Block a user