From 7b76afe232ffa77da251e24056a143616699ba09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Bokros?= Date: Tue, 30 Jan 2018 14:31:00 +0100 Subject: [PATCH] Use common ZMQConnectorBase as base class --- src/event_handlers/server_connector.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/event_handlers/server_connector.py b/src/event_handlers/server_connector.py index 0856452..078449f 100644 --- a/src/event_handlers/server_connector.py +++ b/src/event_handlers/server_connector.py @@ -5,16 +5,12 @@ from zmq.eventloop import ioloop from zmq.eventloop.zmqstream import ZMQStream from config import PUBLISHER_PORT, RECEIVER_PORT +from util import ZMQConnectorBase ioloop.install() -class ServerConnectorBase: - def __init__(self, zmq_context=None): - self._zmq_context = zmq_context or zmq.Context.instance() - - -class ServerDownlinkConnector(ServerConnectorBase): +class ServerDownlinkConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): super(ServerDownlinkConnector, self).__init__(zmq_context) self._zmq_sub_socket = self._zmq_context.socket(zmq.SUB) @@ -26,7 +22,7 @@ class ServerDownlinkConnector(ServerConnectorBase): self.register_callback = self._zmq_sub_stream.on_recv -class ServerUplinkConnector(ServerConnectorBase): +class ServerUplinkConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): super(ServerUplinkConnector, self).__init__(zmq_context) self._zmq_push_socket = self._zmq_context.socket(zmq.PUSH)