Improve handshake status reporting with connection health check
This commit is contained in:
@@ -70,8 +70,15 @@ class VpnSessionService {
|
|||||||
return 'No handshake yet';
|
return 'No handshake yet';
|
||||||
} else {
|
} else {
|
||||||
final handshakeDateTime = DateTime.fromMillisecondsSinceEpoch(handshakeTime * 1000);
|
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)';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user