mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-09 01:17:16 +00:00
Implement closing EventHandlerConnector
This commit is contained in:
parent
6431fac9b1
commit
613919a5b6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user