Waterfall/Waterfall-Proxy-Patches/0028-TCP-Fast-Open.patch
2022-02-25 12:38:45 -03:00

47 lines
2.4 KiB
Diff

From 78aa1b77b4919f816e9ca983c500f688d4c3643e 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 d320fa94..d0fb0de2 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 {
+ // FlameCord - TCP Fast Open
+ @Getter
+ private int tcpFastOpen = 3;
+
private List<String> colors(final List<String> strings) {
for (int i = 0; i < strings.size(); i++) {
strings.set(i, ChatColor.translateAlternateColorCodes('&', strings.get(i)));
@@ -65,6 +69,8 @@ public class FlameCordConfiguration {
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 f7455a7e..b762d58d 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
@@ -206,6 +206,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