From 42a6ac67d96b60b7a7cbd08b4f706783ac6c2d3b Mon Sep 17 00:00:00 2001 From: Brutus5000 Date: Fri, 17 Nov 2023 16:10:18 +0100 Subject: [PATCH] Remove preference of "official servers" & remove fallback for "closest" servers All servers the client passes to the ICE adapter are to be used. Especially with Xirsys added to the pool. --- .../iceadapter/ice/PeerIceModule.java | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java b/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java index 7d45e76..db1dd13 100644 --- a/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java +++ b/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java @@ -165,21 +165,8 @@ private List getViableIceServers() { return allIceServers; } - List fafIceServers = allIceServers.stream() - .filter(server -> server.getTurnAddresses().stream() - .anyMatch(transportAddress -> transportAddress.getHostString().contains("faforever.com"))) - .toList(); - // Try official servers first - List viableIceServers = fafIceServers.stream() - .filter(IceServer::hasAcceptableLatency) - .collect(Collectors.toList()); - if (!viableIceServers.isEmpty()) { - log.info("Using official ice servers: {}", viableIceServers.stream().map(it -> "[" + it.getTurnAddresses().stream().map(TransportAddress::toString).collect(Collectors.joining(", ")) + "]").collect(Collectors.joining(", "))); - return viableIceServers; - } - // Try servers with acceptable latency - viableIceServers = allIceServers.stream() + List viableIceServers = allIceServers.stream() .filter(IceServer::hasAcceptableLatency) .collect(Collectors.toList()); if (!viableIceServers.isEmpty()) { @@ -187,20 +174,6 @@ private List getViableIceServers() { return viableIceServers; } - // Try the closest server - Optional closestIceServer = allIceServers.stream() - .filter(server -> server.getRoundTripTime().join().isPresent()) - .min(Comparator.comparing(server -> server.getRoundTripTime().join().getAsDouble())); - if (closestIceServer.isPresent()) { - log.info("Using closest ice server: {}", closestIceServer.get().getTurnAddresses().stream().map(TransportAddress::toString).collect(Collectors.joining(", "))); - viableIceServers.add(closestIceServer.get()); - } - - if (!viableIceServers.isEmpty()) { - log.info("Using all reachable ice servers: {}", viableIceServers.stream().map(it -> "[" + it.getTurnAddresses().stream().map(TransportAddress::toString).collect(Collectors.joining(", ")) + "]").collect(Collectors.joining(", "))); - return viableIceServers; - } - log.info("Using all ice servers: {}", allIceServers.stream().map(it -> "[" + it.getTurnAddresses().stream().map(TransportAddress::toString).collect(Collectors.joining(", ")) + "]").collect(Collectors.joining(", "))); return allIceServers; }