From: Michael Tremer Date: Wed, 17 Apr 2024 17:19:14 +0000 (+0200) Subject: wireguard.cgi: Fix connection detection X-Git-Tag: v2.29-core195~14^2~93^2~106 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d3c91bc7a7c9aa84631ca8b90dc5cda63c0ec5a;p=ipfire-2.x.git wireguard.cgi: Fix connection detection Signed-off-by: Michael Tremer --- 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");