From 1310a03148eac23db565ca0c6bbd5ae490024637 Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Wed, 15 Jan 2025 17:26:17 +0000 Subject: network: Improve disconnect handling Make sure disconnecting closes the SSH tunnel connection. Also add keep alive ping to check if connection to server is still there and time out if the keep alive ping does not respond. --- src/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main.py') diff --git a/src/main.py b/src/main.py index cc5a966..a120031 100644 --- a/src/main.py +++ b/src/main.py @@ -350,6 +350,9 @@ class WeegtkApplication(Adw.Application): self.network.desync_weechat() elif message.msgid == '_upgrade_ended': self.network.sync_weechat() + elif message.msgid == "_pong": + # For now don't do anything with pong messages + pass else: print(f"Unknown message with id {message.msgid}") @@ -372,9 +375,8 @@ class WeegtkApplication(Adw.Application): self.pages.insert(index, page) def buffer_input(self, source_object, full_name, text): - if self.network.is_connected(): - message = f"input {full_name} {text}\n" - self.network.send_to_weechat(message) + message = f"input {full_name} {text}\n" + self.network.send_to_weechat(message) def main(version): """The application's entry point.""" -- cgit