From 26c6c5d1e657c476775a5886baeec1d5ca5efebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 21 May 2019 13:44:02 +0200 Subject: [PATCH] Refactor EventHandlerConnector family of classes --- .../networking/server/event_handler_connector.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/tfw/networking/server/event_handler_connector.py b/lib/tfw/networking/server/event_handler_connector.py index 5075c56..bc6c9be 100644 --- a/lib/tfw/networking/server/event_handler_connector.py +++ b/lib/tfw/networking/server/event_handler_connector.py @@ -21,6 +21,10 @@ class EventHandlerDownlinkConnector(ZMQConnectorBase): self._zmq_pull_socket.bind(address) LOG.debug('Pull socket bound to %s', address) + def register_callback(self, callback): + callback = with_deserialize_tfw_msg(callback) + self._zmq_pull_stream.on_recv(callback) + class EventHandlerUplinkConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): @@ -30,11 +34,9 @@ class EventHandlerUplinkConnector(ZMQConnectorBase): self._zmq_pub_socket.bind(address) LOG.debug('Pub socket bound to %s', address) - -class EventHandlerConnector(EventHandlerDownlinkConnector, EventHandlerUplinkConnector): - def register_callback(self, callback): - callback = with_deserialize_tfw_msg(callback) - self._zmq_pull_stream.on_recv(callback) - def send_message(self, message: dict): self._zmq_pub_socket.send_multipart(serialize_tfw_msg(message)) + + +class EventHandlerConnector(EventHandlerDownlinkConnector, EventHandlerUplinkConnector): + pass