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)