mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:39:58 +03:00
22 lines
819 B
Diff
22 lines
819 B
Diff
--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java
|
|
+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java
|
|
@@ -46,12 +46,18 @@
|
|
public void writePacketData(PacketBuffer buf) throws IOException
|
|
{
|
|
buf.writeString(this.channel);
|
|
+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe.
|
|
+ this.data.markReaderIndex();
|
|
buf.writeBytes((ByteBuf)this.data);
|
|
+ this.data.resetReaderIndex();
|
|
+ }
|
|
}
|
|
|
|
public void processPacket(INetHandlerPlayClient handler)
|
|
{
|
|
handler.handleCustomPayload(this);
|
|
+ // Forge: fix network buffer leaks (MC-121884)
|
|
+ if (this.data != null) this.data.release();
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|