Add internal netty pipeline events
This commit is contained in:
parent
b327e17634
commit
22ac7d6817
|
@ -105,6 +105,42 @@ index 0000000000000000000000000000000000000000..30e62719e0a83525daa33cf41cb61df3
|
|||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/network/ConnectionEvent.java b/src/main/java/io/papermc/paper/network/ConnectionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0d7e7db9e37ef0183c32b217bd944fb4f41ab83a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/network/ConnectionEvent.java
|
||||
@@ -0,0 +1,10 @@
|
||||
+package io.papermc.paper.network;
|
||||
+
|
||||
+/**
|
||||
+ * Internal connection pipeline events.
|
||||
+ */
|
||||
+public enum ConnectionEvent {
|
||||
+
|
||||
+ COMPRESSION_THRESHOLD_SET,
|
||||
+ COMPRESSION_DISABLED
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 91556b52edaa1d5c4dc73a825c77b9a66b002c61..91cf0a6b5061bf4731731fdd69beb80fb30c6b51 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -555,6 +555,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
} else {
|
||||
this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
|
||||
}
|
||||
+ this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper
|
||||
} else {
|
||||
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
|
||||
this.channel.pipeline().remove("decompress");
|
||||
@@ -563,6 +564,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
|
||||
this.channel.pipeline().remove("compress");
|
||||
}
|
||||
+ this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_DISABLED); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||
index 72fbc58f7d003b7af3c35e5fc504010307c7086b..076c1d5fb69a4a30b3e412e85b17db09fd9a1def 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||
|
|
|
@ -11,10 +11,10 @@ Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
|
|||
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 91556b52edaa1d5c4dc73a825c77b9a66b002c61..00abdd5bba02b7cdf8dbdc423594f0fde890dd84 100644
|
||||
index 91cf0a6b5061bf4731731fdd69beb80fb30c6b51..45598a94524519257c5ffb03800f0b081f4d7a78 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -627,6 +627,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -629,6 +629,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
// Spigot Start
|
||||
public SocketAddress getRawAddress()
|
||||
{
|
||||
|
|
|
@ -268,7 +268,7 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431
|
|||
return this.threshold;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 7e2256ac88e874b34b6a0c638bfced368ba29be2..9549e8ed4b245176b340ab2f22f4bdefdbe28a9e 100644
|
||||
index e0a29625d17d315b2f614c65a0a82c6d1a82676d..f018d07cbea3785876a547da158cf60eb831a5fb 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -641,11 +641,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
@ -322,8 +322,8 @@ index 7e2256ac88e874b34b6a0c638bfced368ba29be2..9549e8ed4b245176b340ab2f22f4bdef
|
|||
- this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
|
||||
+ this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressor, compressionThreshold)); // Paper
|
||||
}
|
||||
this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper
|
||||
} else {
|
||||
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||
index 9e7154c9df96d5a0577886d43a98a73626a8f189..af3e70920221b6bd127bb3aed7f1e0a7e9e4c322 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||
|
|
Loading…
Reference in New Issue