mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 05:32:18 -07:00
Add proper async player disconnections
Blocking can cause performance problems
This commit is contained in:
@@ -269,7 +269,22 @@
|
||||
public void write(ChannelHandlerContext channelhandlercontext, Object object, ChannelPromise channelpromise) throws Exception {
|
||||
super.write(channelhandlercontext, object, channelpromise);
|
||||
}
|
||||
@@ -633,6 +763,7 @@
|
||||
@@ -613,6 +743,14 @@
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start - add proper async disconnect
|
||||
+ public void enableAutoRead() {
|
||||
+ if (this.channel != null) {
|
||||
+ this.channel.config().setAutoRead(true);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - add proper async disconnect
|
||||
+
|
||||
public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) {
|
||||
if (compressionThreshold >= 0) {
|
||||
ChannelHandler channelhandler = this.channel.pipeline().get("decompress");
|
||||
@@ -633,6 +771,7 @@
|
||||
} else {
|
||||
this.channel.pipeline().addAfter("prepender", "compress", new CompressionEncoder(compressionThreshold));
|
||||
}
|
||||
@@ -277,7 +292,7 @@
|
||||
} else {
|
||||
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
|
||||
this.channel.pipeline().remove("decompress");
|
||||
@@ -641,6 +772,7 @@
|
||||
@@ -641,6 +780,7 @@
|
||||
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
|
||||
this.channel.pipeline().remove("compress");
|
||||
}
|
||||
@@ -285,7 +300,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -661,6 +793,27 @@
|
||||
@@ -661,6 +801,27 @@
|
||||
|
||||
packetlistener1.onDisconnect(disconnectiondetails);
|
||||
}
|
||||
|
Reference in New Issue
Block a user