Waterfall/Waterfall-Proxy-Patches/0027-TCP-Fast-Open.patch

47 lines
2.4 KiB
Diff
Raw Normal View History

2022-03-06 15:57:48 +01:00
From 216628c6de6f3697ed82a84be11d73301705e170 Mon Sep 17 00:00:00 2001
2022-02-25 03:50:21 +01:00
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
2022-03-06 15:57:48 +01:00
index 48deace6..d972fcea 100644
2022-02-25 03:50:21 +01:00
--- 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;
2022-03-06 15:57:48 +01:00
public class FlameCordConfiguration extends FlameConfig {
2022-02-25 03:50:21 +01:00
+ // 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)));
2022-03-06 15:57:48 +01:00
@@ -55,6 +59,8 @@ public class FlameCordConfiguration extends FlameConfig {
2022-02-25 04:13:37 +01:00
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)));
2022-02-25 03:50:21 +01:00
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
2022-03-04 17:38:12 +01:00
index a840bc70..f4bf745c 100644
2022-02-25 03:50:21 +01:00
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
2022-03-04 17:38:12 +01:00
@@ -198,6 +198,8 @@ public class PipelineUtils
2022-02-25 03:50:21 +01:00
// 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