summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-08-27 15:51:54 +1000
committermd_5 <git@md-5.net>2016-08-27 15:51:54 +1000
commit43ab2669d768f1a2cfe32418cd275d110691af05 (patch)
tree40fe550523094095402672f298c750d126c9bce9 /nms-patches
parent2f5bda8a67b24d8569964f64fb92c2fcda05303e (diff)
downloadcraftbukkit-43ab2669d768f1a2cfe32418cd275d110691af05.tar
craftbukkit-43ab2669d768f1a2cfe32418cd275d110691af05.tar.gz
craftbukkit-43ab2669d768f1a2cfe32418cd275d110691af05.tar.lz
craftbukkit-43ab2669d768f1a2cfe32418cd275d110691af05.tar.xz
craftbukkit-43ab2669d768f1a2cfe32418cd275d110691af05.zip
SPIGOT-2634: Concurrency issue in FileIOThread
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/ChunkRegionLoader.patch43
1 files changed, 37 insertions, 6 deletions
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch
index 55025dfe..a2335fa2 100644
--- a/nms-patches/ChunkRegionLoader.patch
+++ b/nms-patches/ChunkRegionLoader.patch
@@ -90,7 +90,38 @@
}
}
}
-@@ -131,10 +179,14 @@
+@@ -98,20 +146,27 @@
+ }
+
+ public boolean c() {
+- if (this.b.isEmpty()) {
++ // CraftBukkit start
++ Iterator<Map.Entry<ChunkCoordIntPair, NBTTagCompound>> iter = this.b.entrySet().iterator();
++ if (!iter.hasNext()) {
++ // CraftBukkit end
+ if (this.f) {
+ ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", new Object[] { this.d.getName()});
+ }
+
+ return false;
+ } else {
+- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.b.keySet().iterator().next();
++ // CraftBukkit start
++ Map.Entry<ChunkCoordIntPair, NBTTagCompound> entry = iter.next();
++ iter.remove(); // Pop single entry
++ ChunkCoordIntPair chunkcoordintpair = entry.getKey();
++ // CraftBukkit end
+
+ boolean flag;
+
+ try {
+ this.c.add(chunkcoordintpair);
+- NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.remove(chunkcoordintpair);
++ NBTTagCompound nbttagcompound = (NBTTagCompound) entry.getValue(); // CraftBukkit
+
+ if (nbttagcompound != null) {
+ try {
+@@ -131,10 +186,14 @@
}
private void b(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
@@ -106,7 +137,7 @@
}
public void b(World world, Chunk chunk) throws IOException {}
-@@ -149,6 +201,7 @@
+@@ -149,6 +208,7 @@
if (this.c()) {
continue;
}
@@ -114,7 +145,7 @@
}
} finally {
this.f = false;
-@@ -326,6 +379,13 @@
+@@ -326,6 +386,13 @@
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
@@ -128,7 +159,7 @@
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
-@@ -369,7 +429,7 @@
+@@ -369,7 +436,7 @@
}
}
@@ -137,7 +168,7 @@
}
@Nullable
-@@ -397,14 +457,20 @@
+@@ -397,14 +464,20 @@
}
@Nullable
@@ -159,7 +190,7 @@
return null;
} else {
if (nbttagcompound.hasKeyOfType("Passengers", 9)) {
-@@ -433,8 +499,14 @@
+@@ -433,8 +506,14 @@
}
}