mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 00:01:31 +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 zmq.eventloop.zmqstream import ZMQStream
|
||||||
|
|
||||||
from config import PUBLISHER_PORT, RECEIVER_PORT
|
from config import PUBLISHER_PORT, RECEIVER_PORT
|
||||||
|
from util import ZMQConnectorBase
|
||||||
|
|
||||||
ioloop.install()
|
ioloop.install()
|
||||||
|
|
||||||
|
|
||||||
class ServerConnectorBase:
|
class ServerDownlinkConnector(ZMQConnectorBase):
|
||||||
def __init__(self, zmq_context=None):
|
|
||||||
self._zmq_context = zmq_context or zmq.Context.instance()
|
|
||||||
|
|
||||||
|
|
||||||
class ServerDownlinkConnector(ServerConnectorBase):
|
|
||||||
def __init__(self, zmq_context=None):
|
def __init__(self, zmq_context=None):
|
||||||
super(ServerDownlinkConnector, self).__init__(zmq_context)
|
super(ServerDownlinkConnector, self).__init__(zmq_context)
|
||||||
self._zmq_sub_socket = self._zmq_context.socket(zmq.SUB)
|
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
|
self.register_callback = self._zmq_sub_stream.on_recv
|
||||||
|
|
||||||
|
|
||||||
class ServerUplinkConnector(ServerConnectorBase):
|
class ServerUplinkConnector(ZMQConnectorBase):
|
||||||
def __init__(self, zmq_context=None):
|
def __init__(self, zmq_context=None):
|
||||||
super(ServerUplinkConnector, self).__init__(zmq_context)
|
super(ServerUplinkConnector, self).__init__(zmq_context)
|
||||||
self._zmq_push_socket = self._zmq_context.socket(zmq.PUSH)
|
self._zmq_push_socket = self._zmq_context.socket(zmq.PUSH)
|
||||||
|
Loading…
Reference in New Issue
Block a user