Move ZMQ bind address logging to TFWServer

This commit is contained in:
Kristóf Tóth 2019-07-31 17:36:03 +02:00
parent 96c6c9b358
commit 38eec06b4d
2 changed files with 6 additions and 4 deletions

View File

@ -18,7 +18,6 @@ class ZMQDownlinkListener:
self._zmq_pull_socket.setsockopt(zmq.RCVHWM, 0)
self._zmq_pull_socket.bind(bind_addr)
self._zmq_pull_stream = ZMQStream(self._zmq_pull_socket)
LOG.debug('Pull socket bound to %s', bind_addr)
def register_callback(self, callback):
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.setsockopt(zmq.SNDHWM, 0)
self._zmq_pub_socket.bind(bind_addr)
LOG.debug('Pub socket bound to %s', bind_addr)
def send_message(self, message: dict):
self._zmq_pub_socket.send_multipart(serialize_tfw_msg(message))

View File

@ -16,10 +16,14 @@ class TFWServer:
SUB socket.
"""
def __init__(self):
downlink_bind_addr = f'tcp://*:{TFWENV.PULL_PORT}'
uplink_bind_addr = f'tcp://*:{TFWENV.PUB_PORT}'
self._listener = ZMQListener(
downlink_bind_addr=f'tcp://*:{TFWENV.PULL_PORT}',
uplink_bind_addr=f'tcp://*:{TFWENV.PUB_PORT}'
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([(
r'/ws', ZMQWebSocketRouter, {
'listener': self._listener,