mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 04:01:56 +00:00
Use common ZMQConnectorBase as base class
This commit is contained in:
parent
340ea31856
commit
7b76afe232
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user