From 85f9c8266960a1031c788a73c63f2e7ce32ac8d1 Mon Sep 17 00:00:00 2001 From: Rasmus Praestholm Date: Tue, 16 Nov 2021 04:42:31 -0600 Subject: [PATCH] chore: remove some slow logging (#4936) Co-authored-by: Nail Khanipov --- .../network/internal/NetworkSystemImpl.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java b/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java index 4a459e35df0..e61a3d1412c 100644 --- a/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java +++ b/engine/src/main/java/org/terasology/engine/network/internal/NetworkSystemImpl.java @@ -80,13 +80,8 @@ import org.terasology.reflection.metadata.FieldMetadata; import java.net.BindException; -import java.net.InetAddress; import java.net.InetSocketAddress; -import java.net.InterfaceAddress; -import java.net.NetworkInterface; -import java.net.SocketException; import java.util.Collection; -import java.util.Enumeration; import java.util.List; import java.util.Map; import java.util.Optional; @@ -177,32 +172,11 @@ public void host(int port, boolean dedicatedServer) throws HostingFailedExceptio logger.info("No server MOTD is defined"); } - // enumerate all network interfaces that listen - Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); - - while (interfaces.hasMoreElements()) { - NetworkInterface ifc = interfaces.nextElement(); - if (!ifc.isLoopback()) { - for (InterfaceAddress ifadr : ifc.getInterfaceAddresses()) { - // Exclude interfaces with the following key words to avoid common virtual and otherwise unlikely useful nics - // TODO: Make this configurable via config.cfg? - if (ifc.getDisplayName().contains("VirtualBox") || ifc.getDisplayName().contains("ISATAP")) { - logger.info("Skipping filtered interface name {}", ifc.getDisplayName()); - } else { - InetAddress adr = ifadr.getAddress(); - logger.info("Listening on network interface \"{}\", hostname \"{}\" ({})", - ifc.getDisplayName(), adr.getCanonicalHostName(), adr.getHostAddress()); - } - } - } - } if (serverChannelFuture.isSuccess()) { logger.info("Server started"); } serverChannelFuture.sync(); nextNetworkTick = time.getRealTimeInMs(); - } catch (SocketException e) { - throw new HostingFailedException("Could not identify network interfaces", e); } catch (ChannelException e) { if (e.getCause() instanceof BindException) { throw new HostingFailedException("Port already in use (are you already hosting a game?)", @@ -210,7 +184,6 @@ public void host(int port, boolean dedicatedServer) throws HostingFailedExceptio } else { throw new HostingFailedException("Failed to host game", e.getCause()); } - } catch (InterruptedException e) { shutdown(); throw new HostingFailedException("Server has been interrupted", e.getCause());