From 216628c6de6f3697ed82a84be11d73301705e170 Mon Sep 17 00:00:00 2001 From: LinsaFTW <25271111+linsaftw@users.noreply.github.com> Date: Thu, 24 Feb 2022 23:41:57 -0300 Subject: [PATCH] TCP Fast Open diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java index 48deace6..d972fcea 100644 --- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java +++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java @@ -15,6 +15,10 @@ import net.md_5.bungee.config.Configuration; import net.md_5.bungee.config.ConfigurationProvider; public class FlameCordConfiguration extends FlameConfig { + // FlameCord - TCP Fast Open + @Getter + private int tcpFastOpen = 3; + private List colors(final List strings) { for (int i = 0; i < strings.size(); i++) { strings.set(i, ChatColor.translateAlternateColorCodes('&', strings.get(i))); @@ -55,6 +59,8 @@ public class FlameCordConfiguration extends FlameConfig { configuration = configurationProvider.load(configurationFile); } + this.tcpFastOpen = setIfUnexistant("tcp-fast-open", this.tcpFastOpen, configuration); + this.customMotdEnabled = setIfUnexistant("custom-motd.enabled", this.customMotdEnabled, configuration); this.customMotdMotds = colors(new ArrayList<>(setIfUnexistant("custom-motd.motds", this.customMotdMotds, configuration))); 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 a840bc70..f4bf745c 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 @@ -198,6 +198,8 @@ public class PipelineUtils // IP_TOS is not supported (Windows XP / Windows Server 2003) } ch.config().setOption( ChannelOption.TCP_NODELAY, true ); + // FlameCord - TCP Fast Open + ch.config().setOption( ChannelOption.TCP_FASTOPEN, FlameCord.getInstance().getFlameCordConfiguration().getTcpFastOpen() ); ch.config().setAllocator( PooledByteBufAllocator.DEFAULT ); ch.config().setWriteBufferWaterMark( MARK ); -- 2.32.0