From 5de98ec5016fd326b10ecef13d8f1c429b279bd7 Mon Sep 17 00:00:00 2001 From: ImBenji Date: Tue, 5 Aug 2025 17:56:55 +0100 Subject: [PATCH] Improve handshake status reporting with connection health check --- lib/services/vpn_session_service.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/services/vpn_session_service.dart b/lib/services/vpn_session_service.dart index 927345c..cf39fb3 100644 --- a/lib/services/vpn_session_service.dart +++ b/lib/services/vpn_session_service.dart @@ -70,8 +70,15 @@ class VpnSessionService { return 'No handshake yet'; } else { final handshakeDateTime = DateTime.fromMillisecondsSinceEpoch(handshakeTime * 1000); + final now = DateTime.now(); + final duration = now.difference(handshakeDateTime); - return 'Last handshake: ${handshakeDateTime.toLocal()}'; + // Check if connection is dead (more than 2 minutes 30 seconds) + if (duration.inSeconds > 150) { + return 'DEAD - Last handshake: ${handshakeDateTime.toLocal()} (${duration.inMinutes}m ${duration.inSeconds % 60}s ago)'; + } else { + return 'ALIVE - Last handshake: ${handshakeDateTime.toLocal()} (${duration.inSeconds}s ago)'; + } } } }