Throw exceptions when we can't bind
This commit is contained in:
parent
1aa048c61e
commit
fa4b1f668f
@ -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 <md_5@live.com.au>
|
||||
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,14 +266,12 @@ index 0000000..29bb610
|
||||
+ private final List<PendingConnection> pending = Collections.synchronizedList( new ArrayList<PendingConnection>() );
|
||||
+ private final HashMap<InetAddress, Long> throttle = new HashMap<InetAddress, Long>();
|
||||
+
|
||||
+ 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
|
||||
@ -282,15 +280,6 @@ index 0000000..29bb610
|
||||
+ 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?" );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
Loading…
Reference in New Issue
Block a user