Waterfall/Waterfall-Proxy-Patches/0027-TCP-Fast-Open.patch
2022-04-26 10:50:57 -03:00

46 lines
2.7 KiB
Diff

From ca72ee92ce1d192bfd4551116eab80a9efa69bee 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 de2cc947..5d92c20c 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -16,6 +16,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<String> colors(final List<String> strings) {
for (int i = 0; i < strings.size(); i++) {
strings.set(i, ChatColor.translateAlternateColorCodes('&', strings.get(i)));
@@ -113,6 +117,7 @@ public class FlameCordConfiguration extends FlameConfig {
this.fakePlayersEnabled = setIfUnexistant("custom-motd.fakeplayers.enabled", this.fakePlayersEnabled, configuration);
this.fakePlayersAmount = setIfUnexistant("custom-motd.fakeplayers.amount", this.fakePlayersAmount, configuration);
this.fakePlayersMode = setIfUnexistant("custom-motd.fakeplayers.mode", this.fakePlayersMode, configuration);
+ this.tcpFastOpen = setIfUnexistant("tcp-fast-open", this.tcpFastOpen, configuration);
this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler, configuration);
this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, 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 a4c3bd71..ffea1599 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
@@ -194,6 +194,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