From 150919c7bb607e06cd3ecfa8f131e3f88860fd00 Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Thu, 17 Oct 2019 23:28:10 +0100 Subject: [PATCH] Modify to last tests with ping --- Drone/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Drone/client.py b/Drone/client.py index fc8e952..ced54ad 100644 --- a/Drone/client.py +++ b/Drone/client.py @@ -47,6 +47,8 @@ class Client(object): global active_client active_client = self + self._last_ping_time = 0 + def load_config(self): self.config.read(self.config_path) @@ -188,6 +190,9 @@ class Client(object): def _process_connections(self): while True: events = self.selector.select(timeout=1) + if time.time() - self._last_ping_time > 5: + self.server_connection.send_message("ping") + self._last_ping_time = time.time() # logging.debug("tick") for key, mask in events: # TODO add notifier to client! connection = key.data