From fa4b1f668f8283adf5c7e3ed0d211b4734f44bc9 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 24 Jun 2013 12:24:38 +1000 Subject: [PATCH] Throw exceptions when we can't bind --- CraftBukkit-Patches/0025-Netty.patch | 35 ++++++++++------------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/CraftBukkit-Patches/0025-Netty.patch b/CraftBukkit-Patches/0025-Netty.patch index f6d64ef2b..e4f1f0097 100644 --- a/CraftBukkit-Patches/0025-Netty.patch +++ b/CraftBukkit-Patches/0025-Netty.patch @@ -1,4 +1,4 @@ -From f2ce2a2090688544df1fe5fd7d33ee5df2e98ada Mon Sep 17 00:00:00 2001 +From fbe24d2a0d123e149b6311d9d47876b0b19d6fe5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 23 Jun 2013 16:32:51 +1000 Subject: [PATCH] Netty @@ -238,10 +238,10 @@ index 6e6fe1c..68694de 100644 } diff --git a/src/main/java/org/spigotmc/MultiplexingServerConnection.java b/src/main/java/org/spigotmc/MultiplexingServerConnection.java new file mode 100644 -index 0000000..29bb610 +index 0000000..abe5e0c --- /dev/null +++ b/src/main/java/org/spigotmc/MultiplexingServerConnection.java -@@ -0,0 +1,137 @@ +@@ -0,0 +1,126 @@ +package org.spigotmc; + +import java.net.InetAddress; @@ -266,31 +266,20 @@ index 0000000..29bb610 + private final List pending = Collections.synchronizedList( new ArrayList() ); + private final HashMap throttle = new HashMap(); + -+ public MultiplexingServerConnection(MinecraftServer ms) ++ public MultiplexingServerConnection(MinecraftServer ms) throws Throwable + { + super( ms ); + + for ( SpigotConfig.Listener listener : SpigotConfig.listeners ) + { -+ try -+ { -+ // Calculate address, can't use isEmpty due to Java 5 -+ InetAddress socketAddress = ( listener.host.length() == 0 ) ? null : InetAddress.getByName( listener.host ); -+ // Say hello to the log -+ d().getLogger().info( "Starting listener #" + children.size() + " on " + ( socketAddress == null ? "*" : listener.host ) + ":" + listener.port ); -+ // Start connection: Netty / non Netty -+ ServerConnection l = ( listener.netty ) ? new NettyServerConnection( d(), socketAddress, listener.port ) : new DedicatedServerConnection( d(), socketAddress, listener.port ); -+ // Register with other connections -+ children.add( l ); -+ // Gotta catch em all -+ } catch ( Throwable t ) -+ { -+ // Just print some info to the log -+ t.printStackTrace(); -+ d().getLogger().warning( "**** FAILED TO BIND TO PORT!" ); -+ d().getLogger().warning( "The exception was: {0}", t ); -+ d().getLogger().warning( "Perhaps a server is already running on that port?" ); -+ } ++ // Calculate address, can't use isEmpty due to Java 5 ++ InetAddress socketAddress = ( listener.host.length() == 0 ) ? null : InetAddress.getByName( listener.host ); ++ // Say hello to the log ++ d().getLogger().info( "Starting listener #" + children.size() + " on " + ( socketAddress == null ? "*" : listener.host ) + ":" + listener.port ); ++ // Start connection: Netty / non Netty ++ ServerConnection l = ( listener.netty ) ? new NettyServerConnection( d(), socketAddress, listener.port ) : new DedicatedServerConnection( d(), socketAddress, listener.port ); ++ // Register with other connections ++ children.add( l ); + } + } +