2015-01-05 04:32:01 +01:00
|
|
|
From 362c3bed98d1106619cc92ae7513247a538891d2 Mon Sep 17 00:00:00 2001
|
2014-07-21 22:46:54 +02:00
|
|
|
From: slide23 <me@slide.ws>
|
|
|
|
Date: Fri, 20 Dec 2013 20:15:33 -0600
|
|
|
|
Subject: [PATCH] Add Late Bind Option
|
|
|
|
|
|
|
|
Add late-bind config option to delay binding until loading is done.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
2014-11-28 02:17:45 +01:00
|
|
|
index 240c909..ced9efa 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
|
|
@@ -127,6 +127,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
|
|
|
this.a(MinecraftEncryption.b());
|
2014-11-28 02:17:45 +01:00
|
|
|
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.Q());
|
2014-07-21 22:46:54 +02:00
|
|
|
|
|
|
|
+ if (!org.spigotmc.SpigotConfig.lateBind) {
|
|
|
|
try {
|
2014-11-28 02:17:45 +01:00
|
|
|
this.ao().a(inetaddress, this.Q());
|
2014-07-21 22:46:54 +02:00
|
|
|
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
|
|
|
@@ -135,6 +136,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
2014-11-28 02:17:45 +01:00
|
|
|
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
2014-07-21 22:46:54 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here
|
|
|
|
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
|
2014-11-28 02:17:45 +01:00
|
|
|
@@ -225,6 +227,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
2014-07-21 22:46:54 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
+ if (org.spigotmc.SpigotConfig.lateBind) {
|
|
|
|
+ try {
|
2014-11-28 02:17:45 +01:00
|
|
|
+ this.ao().a(inetaddress, this.Q());
|
2014-07-21 22:46:54 +02:00
|
|
|
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
2014-11-28 02:17:45 +01:00
|
|
|
+ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
|
|
|
|
+ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
|
|
|
|
+ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
2014-07-21 22:46:54 +02:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
2014-11-28 02:17:45 +01:00
|
|
|
+
|
|
|
|
if (false && this.aQ() > 0L) { // Spigot - disable
|
|
|
|
Thread thread = new Thread(new ThreadWatchdog(this));
|
|
|
|
|
2014-07-21 22:46:54 +02:00
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2014-11-28 02:17:45 +01:00
|
|
|
index 865a17f..f3187f8 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2014-07-30 10:35:19 +02:00
|
|
|
@@ -227,4 +227,9 @@ public class SpigotConfig
|
2014-07-21 22:46:54 +02:00
|
|
|
System.setProperty( "io.netty.eventLoopThreads", Integer.toString( count ) );
|
|
|
|
Bukkit.getLogger().log( Level.INFO, "Using {0} threads for Netty based IO", count );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean lateBind;
|
|
|
|
+ private static void lateBind() {
|
|
|
|
+ lateBind = getBoolean( "settings.late-bind", false );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2014-11-28 02:17:45 +01:00
|
|
|
2.1.0
|
2014-07-21 22:46:54 +02:00
|
|
|
|