diff --git a/package.json b/package.json index 2230d6e9..b0da63f1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "defguard-client", "private": false, - "version": "1.2.1", + "version": "1.2.2", "type": "module", "scripts": { "dev": "npm-run-all --parallel vite typesafe-i18n", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 4f2b974b..51ebada7 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1354,7 +1354,7 @@ dependencies = [ [[package]] name = "defguard-client" -version = "1.2.1" +version = "1.2.2" dependencies = [ "anyhow", "base64 0.22.1", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "defguard-dg" -version = "1.2.1" +version = "1.2.2" dependencies = [ "clap", "common", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 58150e9d..d4dd7719 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" homepage = "https://github.com/DefGuard/client" license-file = "../LICENSE.md" rust-version = "1.80" -version = "1.2.1" +version = "1.2.2" [package] name = "defguard-client" diff --git a/src-tauri/src/periodic/connection.rs b/src-tauri/src/periodic/connection.rs index 00dafc7b..f07fd414 100644 --- a/src-tauri/src/periodic/connection.rs +++ b/src-tauri/src/periodic/connection.rs @@ -135,17 +135,28 @@ pub async fn verify_active_connections(app_handle: AppHandle) { latest_stat.collected_at, peer_alive_period, ) { - // Check if there was any traffic since the connection was established. - // If not, consider the location dead and disconnect it later without reconnecting. + // Check if there was any traffic since the connection was established + // If not and the connection was established longer than the peer_alive_period, + // consider the location dead and disconnect it later without reconnecting. + let time_since_connection = Utc::now() - con.start.and_utc(); if latest_stat.collected_at < con.start { - debug!( - "There wasn't any activity for Location {} since its \ - connection at {}; considering it being dead and possibly \ - broken. It will be disconnected without a further automatic \ - reconnect.", - con.location_id, con.start - ); - locations_to_disconnect.push((con.location_id, false)); + if time_since_connection > peer_alive_period { + debug!( + "There wasn't any activity for Location {} since its \ + connection at {}; considering it being dead and possibly \ + broken. It will be terminated without a further automatic \ + reconnect.", + con.location_id, con.start + ); + locations_to_disconnect.push((con.location_id, false)); + } else { + debug!( + "There wasn't any activity for Location {} since its \ + connection at {}; The amount of time passed since the connection \ + is {time_since_connection}, the connection will be terminated when it reaches \ + {peer_alive_period}", + con.location_id, con.start); + } } else { debug!( "There wasn't any activity for Location {} for the last \ diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f35b0a57..e2181e9c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "defguard-client", - "version": "1.2.1" + "version": "1.2.2" }, "tauri": { "systemTray": {