From 6d3c91bc7a7c9aa84631ca8b90dc5cda63c0ec5a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 17 Apr 2024 19:19:14 +0200 Subject: [PATCH] wireguard.cgi: Fix connection detection Signed-off-by: Michael Tremer --- html/cgi-bin/wireguard.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/cgi-bin/wireguard.cgi b/html/cgi-bin/wireguard.cgi index c1cc7581d..d2bc80247 100644 --- a/html/cgi-bin/wireguard.cgi +++ b/html/cgi-bin/wireguard.cgi @@ -180,7 +180,7 @@ END my $status = $dump{$pubkey} || (); # WireGuard performs a handshake very two minutes, so we should be considered online then - my $is_connected = ($status && ($status->{"latest-handshake"} - time <= 120)); + my $is_connected = (time - $status->{"latest-handshake"}) <= 120; if ($is_connected) { push(@status, "is-connected"); -- 2.47.3