Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 11:30:06 +01:00
c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
72 Zeilen
3.8 KiB
Diff
72 Zeilen
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Andrew Steinborn <git@steinborn.me>
|
|
Date: Sun, 5 Jul 2020 22:38:18 -0400
|
|
Subject: [PATCH] Optimize NetworkManager Exception Handling
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java
|
|
index 32f5470baa88c3dc80db1bb547e1c982ac90237d..64df649e8d209246cc836793160eb0a1506826f8 100644
|
|
--- a/src/main/java/net/minecraft/server/EnumProtocol.java
|
|
+++ b/src/main/java/net/minecraft/server/EnumProtocol.java
|
|
@@ -129,6 +129,7 @@ public enum EnumProtocol {
|
|
|
|
@Nullable
|
|
public Packet<?> a(int i) {
|
|
+ if (i < 0 || i >= this.b.size()) return null; // Paper
|
|
Supplier<? extends Packet<T>> supplier = (Supplier) this.b.get(i);
|
|
|
|
return supplier != null ? (Packet) supplier.get() : null;
|
|
diff --git a/src/main/java/net/minecraft/server/PacketSplitter.java b/src/main/java/net/minecraft/server/PacketSplitter.java
|
|
index cdaa8be90d16b0e9e2f92a3e2ed120b856feab54..2aaa8770edfd8acc6861c23176e405863858b275 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketSplitter.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketSplitter.java
|
|
@@ -9,11 +9,21 @@ import java.util.List;
|
|
|
|
public class PacketSplitter extends ByteToMessageDecoder {
|
|
|
|
+ private final byte[] lenBuf = new byte[3]; // Paper
|
|
public PacketSplitter() {}
|
|
|
|
protected void decode(ChannelHandlerContext channelhandlercontext, ByteBuf bytebuf, List<Object> list) throws Exception {
|
|
+ // Paper start - if channel is not active just discard the packet
|
|
+ if (!channelhandlercontext.channel().isActive()) {
|
|
+ bytebuf.skipBytes(bytebuf.readableBytes());
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
bytebuf.markReaderIndex();
|
|
- byte[] abyte = new byte[3];
|
|
+ // Paper start - reuse temporary length buffer
|
|
+ byte[] abyte = lenBuf;
|
|
+ java.util.Arrays.fill(abyte, (byte) 0);
|
|
+ // Paper end
|
|
|
|
for (int i = 0; i < abyte.length; ++i) {
|
|
if (!bytebuf.isReadable()) {
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
|
|
index eb3269e0ea3ce33d08e9eee3bca7cf434921e991..7ea293f38dedd6066601d94adbe175a31c502e1f 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
|
|
@@ -22,6 +22,21 @@ public class PlayerConnectionUtils {
|
|
try (Timing ignored = timing.startTiming()) { // Paper - timings
|
|
packet.a(t0);
|
|
} // Paper - timings
|
|
+ // Paper start
|
|
+ catch (Exception e) {
|
|
+ NetworkManager networkmanager = t0.a();
|
|
+ if (networkmanager.getPlayer() != null) {
|
|
+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getName(), networkmanager.getSocketAddress(), e);
|
|
+ } else {
|
|
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getSocketAddress(), e);
|
|
+ }
|
|
+ ChatComponentText error = new ChatComponentText("Packet processing error");
|
|
+ networkmanager.sendPacket(new PacketPlayOutKickDisconnect(error), (future) -> {
|
|
+ networkmanager.close(error);
|
|
+ });
|
|
+ networkmanager.stopReading();
|
|
+ }
|
|
+ // Paper end
|
|
} else {
|
|
PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet);
|
|
}
|