From 2d52b6216950d46afc39e0af20972906ee717555 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 11 Jun 2013 11:54:45 +1000 Subject: [PATCH] Split shutdown hang fix into own patch --- CraftBukkit-Patches/0005-Spigot-Changes.patch | 23 +++----------- .../0050-Prevent-Shutdown-Hang.patch | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 CraftBukkit-Patches/0050-Prevent-Shutdown-Hang.patch diff --git a/CraftBukkit-Patches/0005-Spigot-Changes.patch b/CraftBukkit-Patches/0005-Spigot-Changes.patch index 7e7887b05b..4db77b9279 100644 --- a/CraftBukkit-Patches/0005-Spigot-Changes.patch +++ b/CraftBukkit-Patches/0005-Spigot-Changes.patch @@ -1,6 +1,6 @@ -From c249eb223ad161d2a850e9b575956ed0034d676f Mon Sep 17 00:00:00 2001 +From 82614bb009f47f71c81667af3e86f460d60cf5f7 Mon Sep 17 00:00:00 2001 From: md_5 -Date: Sat, 4 May 2013 10:14:01 +1000 +Date: Tue, 11 Jun 2013 11:53:13 +1000 Subject: [PATCH] Spigot Changes @@ -239,7 +239,7 @@ index bee715b..9643480 100644 if (pendingchunktosave != null) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index cc99ff5..1697b18 100644 +index f1c2d48..e1872cc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -845,8 +845,20 @@ public class PlayerConnection extends Connection { @@ -285,7 +285,7 @@ index cc99ff5..1697b18 100644 } } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index b7e327b..169fa90 100644 +index b7e327b..0e3a6a1 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -307,7 +307,7 @@ public abstract class PlayerList { @@ -297,21 +297,6 @@ index b7e327b..169fa90 100644 } else { String s2 = socketaddress.toString(); -@@ -1048,7 +1048,13 @@ public abstract class PlayerList { - - public void r() { - while (!this.players.isEmpty()) { -- ((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message -+ // Spigot start -+ EntityPlayer p = (EntityPlayer) this.players.get(0); -+ p.playerConnection.disconnect(this.server.server.getShutdownMessage()); -+ if ((!this.players.isEmpty()) && (this.players.get(0) == p)) { -+ this.players.remove(0); // Prevent shutdown hang if already disconnected -+ } -+ // Spigot end - } - } - diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 3a4ddea..70dd295 100644 --- a/src/main/java/net/minecraft/server/World.java diff --git a/CraftBukkit-Patches/0050-Prevent-Shutdown-Hang.patch b/CraftBukkit-Patches/0050-Prevent-Shutdown-Hang.patch new file mode 100644 index 0000000000..777995bf50 --- /dev/null +++ b/CraftBukkit-Patches/0050-Prevent-Shutdown-Hang.patch @@ -0,0 +1,30 @@ +From d85099a3bdf56d4f398ce0045acb9b66f9a91886 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 11 Jun 2013 11:54:32 +1000 +Subject: [PATCH] Prevent Shutdown Hang + +Prevents server hanging if players disconnect during the shutdown sequence. + +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index d5387f3..e5d2710 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -1071,7 +1071,14 @@ public abstract class PlayerList { + + public void r() { + while (!this.players.isEmpty()) { +- ((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message ++ // Spigot start ++ EntityPlayer p = (EntityPlayer) this.players.get( 0 ); ++ p.playerConnection.disconnect( this.server.server.getShutdownMessage() ); ++ if ( ( !this.players.isEmpty() ) && ( this.players.get( 0 ) == p ) ) ++ { ++ this.players.remove( 0 ); // Prevent shutdown hang if already disconnected ++ } ++ // Spigot end + } + } + +-- +1.8.1.2 +