From 613919a5b60d4d2876c20c27e69647fbe197db22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 21 May 2019 13:59:42 +0200 Subject: [PATCH] Implement closing EventHandlerConnector --- lib/tfw/networking/server/event_handler_connector.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tfw/networking/server/event_handler_connector.py b/lib/tfw/networking/server/event_handler_connector.py index 8b13338..7b56a88 100644 --- a/lib/tfw/networking/server/event_handler_connector.py +++ b/lib/tfw/networking/server/event_handler_connector.py @@ -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)