From c00d3a1e154d00ce66f136f751437c67155de9f0 Mon Sep 17 00:00:00 2001 From: Vadim Nikolaev Date: Fri, 19 Apr 2024 11:00:35 +0300 Subject: [PATCH] XEP-0215: Resume updating the field `expires` after reconnection --- plugins/ice/src/plugin.vala | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/ice/src/plugin.vala b/plugins/ice/src/plugin.vala index aa4b6d41..5d19b5f5 100644 --- a/plugins/ice/src/plugin.vala +++ b/plugins/ice/src/plugin.vala @@ -37,7 +37,6 @@ public class Dino.Plugins.Ice.Plugin : RootInterface, Object { stream.get_module(JingleRawUdp.Module.IDENTITY).set_local_ip_address_handler(get_local_ip_addresses); } }); - app.stream_interactor.stream_negotiated.connect(external_discovery_refresh_services); app.stream_interactor.connection_manager.connection_state_changed.connect(on_connection_state_changed); } @@ -102,13 +101,20 @@ public class Dino.Plugins.Ice.Plugin : RootInterface, Object { } public void on_connection_state_changed(Account account, ConnectionManager.ConnectionState state) { - if (state == ConnectionManager.ConnectionState.DISCONNECTED) { - XmppStream? stream = app.stream_interactor.connection_manager.get_stream(account); - if (stream == null) return; - if (!timeouts.has_key(stream)) return; + switch(state) + { + case ConnectionManager.ConnectionState.DISCONNECTED: + XmppStream? stream = app.stream_interactor.connection_manager.get_stream(account); + if (stream == null) return; + if (!timeouts.has_key(stream)) return; - Source.remove(timeouts[stream].timeout_handle_id); - timeouts.unset(stream); + Source.remove(timeouts[stream].timeout_handle_id); + timeouts.unset(stream); + break; + case ConnectionManager.ConnectionState.CONNECTED: + XmppStream? stream = app.stream_interactor.connection_manager.get_stream(account); + external_discovery_refresh_services(account, stream); + break; } }