2016-02-29 21:33:06 +00:00
|
|
|
From 07a28ec70f33b9e7b16d76f412bf06d060c8f191 Mon Sep 17 00:00:00 2001
|
2014-07-21 20:46:54 +00: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
|
2016-02-29 21:33:06 +00:00
|
|
|
index 93ace97..852f8b4 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -176,6 +176,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
2014-07-21 20:46:54 +00:00
|
|
|
this.a(MinecraftEncryption.b());
|
2016-02-29 21:33:06 +00:00
|
|
|
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().isEmpty() ? "*" : this.getServerIp()) + ":" + this.P());
|
2014-07-21 20:46:54 +00:00
|
|
|
|
|
|
|
+ if (!org.spigotmc.SpigotConfig.lateBind) {
|
|
|
|
try {
|
2016-02-29 21:33:06 +00:00
|
|
|
this.am().a(inetaddress, this.P());
|
2015-02-28 11:36:22 +00:00
|
|
|
} catch (IOException ioexception) {
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -184,6 +185,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
2014-11-28 01:17:45 +00:00
|
|
|
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
2014-07-21 20:46:54 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here
|
|
|
|
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -276,6 +278,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
2014-07-21 20:46:54 +00:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
+ if (org.spigotmc.SpigotConfig.lateBind) {
|
|
|
|
+ try {
|
2016-02-29 21:33:06 +00:00
|
|
|
+ this.am().a(inetaddress, this.P());
|
2015-02-28 11:36:22 +00:00
|
|
|
+ } catch (IOException ioexception) {
|
2014-11-28 01:17:45 +00: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 20:46:54 +00:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
2014-11-28 01:17:45 +00:00
|
|
|
+
|
2016-02-29 21:33:06 +00:00
|
|
|
if (false && this.aP() > 0L) { // Spigot - disable
|
2015-02-28 11:36:22 +00:00
|
|
|
Thread thread1 = new Thread(new ThreadWatchdog(this));
|
2014-11-28 01:17:45 +00:00
|
|
|
|
2014-07-21 20:46:54 +00:00
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-05-25 19:09:58 +00:00
|
|
|
index a306266..4edc6af 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-05-25 19:09:58 +00:00
|
|
|
@@ -228,4 +228,9 @@ public class SpigotConfig
|
2014-07-21 20:46:54 +00: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 );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2016-02-29 21:33:06 +00:00
|
|
|
2.5.0
|
2014-07-21 20:46:54 +00:00
|
|
|
|