fix last seen

This commit is contained in:
Lee 2024-04-27 08:49:17 +01:00
parent 35eda54647
commit 9ee1999bec
2 changed files with 7 additions and 1 deletions

@ -2,10 +2,11 @@ package cc.fascinated.piaservers.model;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import java.util.Date; import java.util.Date;
@AllArgsConstructor @Getter @AllArgsConstructor @Getter @Setter
public class PiaServer { public class PiaServer {
/** /**
* The IP of this server. * The IP of this server.

@ -55,6 +55,11 @@ public class PiaManager {
SERVERS.removeAll(toRemove); // Remove the servers SERVERS.removeAll(toRemove); // Remove the servers
System.out.printf("Removed %s old servers\n", toRemove.size()); System.out.printf("Removed %s old servers\n", toRemove.size());
// Update the last seen time for all the servers
for (PiaServer server : SERVERS) {
server.setLastSeen(new Date());
}
// Add the new servers to the list // Add the new servers to the list
for (PiaServerToken serverToken : piaDomain) { for (PiaServerToken serverToken : piaDomain) {
InetAddress address = InetAddress.getByName(serverToken.getHostname()); InetAddress address = InetAddress.getByName(serverToken.getHostname());