Split shutdown hang fix into own patch

This commit is contained in:
md_5 2013-06-11 11:54:45 +10:00
parent d8ce38f1eb
commit 2d52b62169
2 changed files with 34 additions and 19 deletions

View file

@ -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 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 4 May 2013 10:14:01 +1000 Date: Tue, 11 Jun 2013 11:53:13 +1000
Subject: [PATCH] Spigot Changes Subject: [PATCH] Spigot Changes
@ -239,7 +239,7 @@ index bee715b..9643480 100644
if (pendingchunktosave != null) { if (pendingchunktosave != null) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 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 --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/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 { @@ -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 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 --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/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 { @@ -307,7 +307,7 @@ public abstract class PlayerList {
@ -297,21 +297,6 @@ index b7e327b..169fa90 100644
} else { } else {
String s2 = socketaddress.toString(); 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3a4ddea..70dd295 100644 index 3a4ddea..70dd295 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java

View file

@ -0,0 +1,30 @@
From d85099a3bdf56d4f398ce0045acb9b66f9a91886 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
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