mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-28 21:25:47 +01:00
3d4d154926
Solves issue #201 with including the BungeeCord LICENSE file in binary distribution, as the license requires.
47 lines
2.4 KiB
Diff
47 lines
2.4 KiB
Diff
From b4ce6bdcc8f8aa1bad704c38ea5f9a6ac35690c4 Mon Sep 17 00:00:00 2001
|
|
From: Harry <me@harry5573.uk>
|
|
Date: Tue, 26 Jan 2016 01:01:57 +0000
|
|
Subject: [PATCH] Don't create a new KickStringWriter for each new connection.
|
|
|
|
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java b/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java
|
|
index eda9571e..e5275c76 100644
|
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java
|
|
@@ -1,9 +1,11 @@
|
|
package net.md_5.bungee.protocol;
|
|
|
|
import io.netty.buffer.ByteBuf;
|
|
+import io.netty.channel.ChannelHandler.Sharable;
|
|
import io.netty.channel.ChannelHandlerContext;
|
|
import io.netty.handler.codec.MessageToByteEncoder;
|
|
|
|
+@Sharable
|
|
public class KickStringWriter extends MessageToByteEncoder<String>
|
|
{
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
|
|
index b0bbc1d7..0cad5c89 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
|
|
@@ -56,7 +56,7 @@ public class PipelineUtils
|
|
ch.pipeline().addBefore( FRAME_DECODER, LEGACY_DECODER, new LegacyDecoder() );
|
|
ch.pipeline().addAfter( FRAME_DECODER, PACKET_DECODER, new MinecraftDecoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
|
|
ch.pipeline().addAfter( FRAME_PREPENDER, PACKET_ENCODER, new MinecraftEncoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
|
|
- ch.pipeline().addBefore( FRAME_PREPENDER, LEGACY_KICKER, new KickStringWriter() );
|
|
+ ch.pipeline().addBefore( FRAME_PREPENDER, LEGACY_KICKER, PipelineUtils.KICK_STRING_WRITER );
|
|
ch.pipeline().get( HandlerBoss.class ).setHandler( new InitialHandler( BungeeCord.getInstance(), listener ) );
|
|
|
|
if ( listener.isProxyProtocol() )
|
|
@@ -77,6 +77,7 @@ public class PipelineUtils
|
|
public static final String FRAME_PREPENDER = "frame-prepender";
|
|
public static final String LEGACY_DECODER = "legacy-decoder";
|
|
public static final String LEGACY_KICKER = "legacy-kick";
|
|
+ private static final KickStringWriter KICK_STRING_WRITER = new KickStringWriter();
|
|
|
|
private static boolean epoll;
|
|
|
|
--
|
|
2.18.0
|
|
|