From d89a4c48079f0a2c9fa6c4939c9bff1dfae56c16 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 25 Jul 2018 20:50:23 -0400 Subject: [PATCH] Pipeline util name clarity. Remove unneeded handlers. --- .../velocitypowered/proxy/connection/VelocityServer.java | 2 +- .../proxy/connection/backend/ServerConnection.java | 2 +- .../proxy/protocol/netty/MinecraftPipelineUtils.java | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/velocitypowered/proxy/connection/VelocityServer.java b/src/main/java/com/velocitypowered/proxy/connection/VelocityServer.java index f898cc814..c7d2df6aa 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/VelocityServer.java +++ b/src/main/java/com/velocitypowered/proxy/connection/VelocityServer.java @@ -34,7 +34,7 @@ public class VelocityServer { .childHandler(new ChannelInitializer() { @Override protected void initChannel(Channel ch) throws Exception { - MinecraftPipelineUtils.strapPipelineForServer(ch); + MinecraftPipelineUtils.strapPipelineForProxy(ch); MinecraftConnection connection = new MinecraftConnection(ch); connection.setState(StateRegistry.HANDSHAKE); diff --git a/src/main/java/com/velocitypowered/proxy/connection/backend/ServerConnection.java b/src/main/java/com/velocitypowered/proxy/connection/backend/ServerConnection.java index 70cc5a38f..f0aa79050 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/backend/ServerConnection.java +++ b/src/main/java/com/velocitypowered/proxy/connection/backend/ServerConnection.java @@ -27,7 +27,7 @@ public class ServerConnection { .handler(new ChannelInitializer() { @Override protected void initChannel(Channel ch) throws Exception { - MinecraftPipelineUtils.strapPipelineForProxy(ch); + MinecraftPipelineUtils.strapPipelineForBackend(ch); MinecraftConnection connection = new MinecraftConnection(ch); connection.setState(StateRegistry.HANDSHAKE); diff --git a/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftPipelineUtils.java b/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftPipelineUtils.java index 9dd922013..a1e0a0bcd 100644 --- a/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftPipelineUtils.java +++ b/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftPipelineUtils.java @@ -7,7 +7,7 @@ import io.netty.handler.timeout.ReadTimeoutHandler; import java.util.concurrent.TimeUnit; public class MinecraftPipelineUtils { - public static void strapPipelineForServer(Channel ch) { + public static void strapPipelineForProxy(Channel ch) { ch.pipeline().addLast("read-timeout", new ReadTimeoutHandler(30, TimeUnit.SECONDS)); ch.pipeline().addLast("legacy-ping-decode", new LegacyPingDecoder()); ch.pipeline().addLast("frame-decoder", new MinecraftVarintFrameDecoder()); @@ -17,11 +17,9 @@ public class MinecraftPipelineUtils { ch.pipeline().addLast("minecraft-encoder", new MinecraftEncoder(ProtocolConstants.Direction.TO_CLIENT)); } - public static void strapPipelineForProxy(Channel ch) { + public static void strapPipelineForBackend(Channel ch) { ch.pipeline().addLast("read-timeout", new ReadTimeoutHandler(30, TimeUnit.SECONDS)); - ch.pipeline().addLast("legacy-ping-decode", new LegacyPingDecoder()); ch.pipeline().addLast("frame-decoder", new MinecraftVarintFrameDecoder()); - ch.pipeline().addLast("legacy-ping-encode", LegacyPingEncoder.INSTANCE); ch.pipeline().addLast("frame-encoder", MinecraftVarintLengthEncoder.INSTANCE); ch.pipeline().addLast("minecraft-decoder", new MinecraftDecoder(ProtocolConstants.Direction.TO_CLIENT)); ch.pipeline().addLast("minecraft-encoder", new MinecraftEncoder(ProtocolConstants.Direction.TO_SERVER));