Implement closing EventHandlerConnector

This commit is contained in:
Kristóf Tóth 2019-05-21 13:59:42 +02:00
parent 6431fac9b1
commit 613919a5b6

View File

@ -26,6 +26,9 @@ class EventHandlerDownlinkConnector(ZMQConnectorBase):
callback = with_deserialize_tfw_msg(callback)
self._zmq_pull_stream.on_recv(callback)
def close(self):
self._zmq_pull_stream.close()
class EventHandlerUplinkConnector(ZMQConnectorBase):
def __init__(self, zmq_context=None):
@ -39,6 +42,11 @@ class EventHandlerUplinkConnector(ZMQConnectorBase):
def send_message(self, message: dict):
self._zmq_pub_socket.send_multipart(serialize_tfw_msg(message))
def close(self):
self._zmq_pub_socket.close()
class EventHandlerConnector(EventHandlerDownlinkConnector, EventHandlerUplinkConnector):
pass
def close(self):
EventHandlerDownlinkConnector.close(self)
EventHandlerUplinkConnector.close(self)