Paper/CraftBukkit-Patches/0066-Add-Late-Bind-Option.patch

63 lines
2.9 KiB
Diff
Raw Normal View History

From 90bf9dee67afa7e42e9956d5d870b572f98f2938 Mon Sep 17 00:00:00 2001
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
index 7f7ec42..b7f2382 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
2015-05-25 14:05:40 +02:00
@@ -173,6 +173,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.a(MinecraftEncryption.b());
2015-05-09 22:23:26 +02:00
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.R());
+ if (!org.spigotmc.SpigotConfig.lateBind) {
try {
2015-05-09 22:23:26 +02:00
this.aq().a(inetaddress, this.R());
2015-02-28 12:36:22 +01:00
} catch (IOException ioexception) {
2015-05-25 14:05:40 +02:00
@@ -181,6 +182,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?");
return false;
}
+ }
// Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
2015-05-25 14:05:40 +02:00
@@ -270,6 +272,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
// CraftBukkit end
+ if (org.spigotmc.SpigotConfig.lateBind) {
+ try {
2015-05-09 22:23:26 +02:00
+ this.aq().a(inetaddress, this.R());
2015-02-28 12:36:22 +01:00
+ } catch (IOException ioexception) {
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?");
+ return false;
+ }
+ }
2014-11-28 02:17:45 +01:00
+
2015-05-09 22:23:26 +02:00
if (false && this.aS() > 0L) { // Spigot - disable
2015-02-28 12:36:22 +01:00
Thread thread1 = new Thread(new ThreadWatchdog(this));
2014-11-28 02:17:45 +01:00
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index a306266..4edc6af 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -228,4 +228,9 @@ public class SpigotConfig
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 );
+ }
}
--
1.9.0.msysgit.0