|
80 | 80 | import org.terasology.reflection.metadata.FieldMetadata;
|
81 | 81 |
|
82 | 82 | import java.net.BindException;
|
83 |
| -import java.net.InetAddress; |
84 | 83 | import java.net.InetSocketAddress;
|
85 |
| -import java.net.InterfaceAddress; |
86 |
| -import java.net.NetworkInterface; |
87 |
| -import java.net.SocketException; |
88 | 84 | import java.util.Collection;
|
89 |
| -import java.util.Enumeration; |
90 | 85 | import java.util.List;
|
91 | 86 | import java.util.Map;
|
92 | 87 | import java.util.Optional;
|
@@ -177,40 +172,18 @@ public void host(int port, boolean dedicatedServer) throws HostingFailedExceptio
|
177 | 172 | logger.info("No server MOTD is defined");
|
178 | 173 | }
|
179 | 174 |
|
180 |
| - // enumerate all network interfaces that listen |
181 |
| - Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); |
182 |
| - |
183 |
| - while (interfaces.hasMoreElements()) { |
184 |
| - NetworkInterface ifc = interfaces.nextElement(); |
185 |
| - if (!ifc.isLoopback()) { |
186 |
| - for (InterfaceAddress ifadr : ifc.getInterfaceAddresses()) { |
187 |
| - // Exclude interfaces with the following key words to avoid common virtual and otherwise unlikely useful nics |
188 |
| - // TODO: Make this configurable via config.cfg? |
189 |
| - if (ifc.getDisplayName().contains("VirtualBox") || ifc.getDisplayName().contains("ISATAP")) { |
190 |
| - logger.info("Skipping filtered interface name {}", ifc.getDisplayName()); |
191 |
| - } else { |
192 |
| - InetAddress adr = ifadr.getAddress(); |
193 |
| - logger.info("Listening on network interface \"{}\", hostname \"{}\" ({})", |
194 |
| - ifc.getDisplayName(), adr.getCanonicalHostName(), adr.getHostAddress()); |
195 |
| - } |
196 |
| - } |
197 |
| - } |
198 |
| - } |
199 | 175 | if (serverChannelFuture.isSuccess()) {
|
200 | 176 | logger.info("Server started");
|
201 | 177 | }
|
202 | 178 | serverChannelFuture.sync();
|
203 | 179 | nextNetworkTick = time.getRealTimeInMs();
|
204 |
| - } catch (SocketException e) { |
205 |
| - throw new HostingFailedException("Could not identify network interfaces", e); |
206 | 180 | } catch (ChannelException e) {
|
207 | 181 | if (e.getCause() instanceof BindException) {
|
208 | 182 | throw new HostingFailedException("Port already in use (are you already hosting a game?)",
|
209 | 183 | e.getCause());
|
210 | 184 | } else {
|
211 | 185 | throw new HostingFailedException("Failed to host game", e.getCause());
|
212 | 186 | }
|
213 |
| - |
214 | 187 | } catch (InterruptedException e) {
|
215 | 188 | shutdown();
|
216 | 189 | throw new HostingFailedException("Server has been interrupted", e.getCause());
|
|
0 commit comments