mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-08 03:39:48 +01:00
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>
|
From: md_5 <md_5@live.com.au>
|
||||||
Date: Sun, 23 Jun 2013 16:32:51 +1000
|
Date: Sun, 23 Jun 2013 16:32:51 +1000
|
||||||
Subject: [PATCH] Netty
|
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
|
diff --git a/src/main/java/org/spigotmc/MultiplexingServerConnection.java b/src/main/java/org/spigotmc/MultiplexingServerConnection.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..29bb610
|
index 0000000..abe5e0c
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/spigotmc/MultiplexingServerConnection.java
|
+++ b/src/main/java/org/spigotmc/MultiplexingServerConnection.java
|
||||||
@@ -0,0 +1,137 @@
|
@@ -0,0 +1,126 @@
|
||||||
+package org.spigotmc;
|
+package org.spigotmc;
|
||||||
+
|
+
|
||||||
+import java.net.InetAddress;
|
+import java.net.InetAddress;
|
||||||
@ -266,31 +266,20 @@ index 0000000..29bb610
|
|||||||
+ private final List<PendingConnection> pending = Collections.synchronizedList( new ArrayList<PendingConnection>() );
|
+ private final List<PendingConnection> pending = Collections.synchronizedList( new ArrayList<PendingConnection>() );
|
||||||
+ private final HashMap<InetAddress, Long> throttle = new HashMap<InetAddress, Long>();
|
+ private final HashMap<InetAddress, Long> throttle = new HashMap<InetAddress, Long>();
|
||||||
+
|
+
|
||||||
+ public MultiplexingServerConnection(MinecraftServer ms)
|
+ public MultiplexingServerConnection(MinecraftServer ms) throws Throwable
|
||||||
+ {
|
+ {
|
||||||
+ super( ms );
|
+ super( ms );
|
||||||
+
|
+
|
||||||
+ for ( SpigotConfig.Listener listener : SpigotConfig.listeners )
|
+ 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 );
|
||||||
+ // Calculate address, can't use isEmpty due to Java 5
|
+ // Say hello to the log
|
||||||
+ InetAddress socketAddress = ( listener.host.length() == 0 ) ? null : InetAddress.getByName( listener.host );
|
+ d().getLogger().info( "Starting listener #" + children.size() + " on " + ( socketAddress == null ? "*" : listener.host ) + ":" + listener.port );
|
||||||
+ // Say hello to the log
|
+ // Start connection: Netty / non Netty
|
||||||
+ d().getLogger().info( "Starting listener #" + children.size() + " on " + ( socketAddress == null ? "*" : listener.host ) + ":" + listener.port );
|
+ ServerConnection l = ( listener.netty ) ? new NettyServerConnection( d(), socketAddress, listener.port ) : new DedicatedServerConnection( d(), socketAddress, listener.port );
|
||||||
+ // Start connection: Netty / non Netty
|
+ // Register with other connections
|
||||||
+ ServerConnection l = ( listener.netty ) ? new NettyServerConnection( d(), socketAddress, listener.port ) : new DedicatedServerConnection( d(), socketAddress, listener.port );
|
+ children.add( l );
|
||||||
+ // 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