mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-06 18:51:21 +01:00
100 lines
4.5 KiB
Diff
100 lines
4.5 KiB
Diff
From 9b03768079f2ac841fa87e3e10d3808b7bc3cae3 Mon Sep 17 00:00:00 2001
|
|
From: linsaftw <25271111+linsaftw@users.noreply.github.com>
|
|
Date: Wed, 19 May 2021 12:56:29 -0300
|
|
Subject: [PATCH] Apply buffer limits
|
|
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
index fb19d5dc..7c5af95b 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
@@ -378,6 +378,9 @@ public class BungeeCord extends ProxyServer
|
|
}
|
|
}
|
|
};
|
|
+
|
|
+ int bufferSize = 65536; // FlameCord
|
|
+
|
|
new ServerBootstrap()
|
|
.channel( PipelineUtils.getServerChannel( info.getSocketAddress() ) )
|
|
.option( ChannelOption.SO_REUSEADDR, true ) // TODO: Move this elsewhere!
|
|
@@ -385,6 +388,8 @@ public class BungeeCord extends ProxyServer
|
|
.childHandler( PipelineUtils.SERVER_CHILD )
|
|
.group( bossEventLoopGroup, workerEventLoopGroup )
|
|
.localAddress( info.getSocketAddress() )
|
|
+ .childOption(ChannelOption.SO_RCVBUF, bufferSize) // FlameCord
|
|
+ .childOption(ChannelOption.SO_SNDBUF, bufferSize) // FlameCord
|
|
.bind().addListener( listener );
|
|
|
|
if ( info.isQueryEnabled() )
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/http/HttpInitializer.java b/proxy/src/main/java/net/md_5/bungee/http/HttpInitializer.java
|
|
index 37657c4c..ba31471e 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/http/HttpInitializer.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/http/HttpInitializer.java
|
|
@@ -2,6 +2,7 @@ package net.md_5.bungee.http;
|
|
|
|
import io.netty.channel.Channel;
|
|
import io.netty.channel.ChannelInitializer;
|
|
+import io.netty.channel.ChannelOption;
|
|
import io.netty.handler.codec.http.HttpClientCodec;
|
|
import io.netty.handler.ssl.SslContextBuilder;
|
|
import io.netty.handler.ssl.SslHandler;
|
|
@@ -23,6 +24,11 @@ public class HttpInitializer extends ChannelInitializer<Channel>
|
|
@Override
|
|
protected void initChannel(Channel ch) throws Exception
|
|
{
|
|
+ int bufferSize = 65536; // FlameCord
|
|
+
|
|
+ ch.config().setOption( ChannelOption.SO_RCVBUF, bufferSize ); // FlameCord
|
|
+ ch.config().setOption( ChannelOption.SO_SNDBUF, bufferSize ); // FlameCord
|
|
+
|
|
ch.pipeline().addLast( "timeout", new ReadTimeoutHandler( HttpClient.TIMEOUT, TimeUnit.MILLISECONDS ) );
|
|
if ( ssl )
|
|
{
|
|
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 a6722b41..5de2e6ef 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
|
|
@@ -207,6 +207,11 @@ public class PipelineUtils
|
|
{
|
|
// IP_TOS is not supported (Windows XP / Windows Server 2003)
|
|
}
|
|
+
|
|
+ int bufferSize = 65536; // FlameCord
|
|
+
|
|
+ ch.config().setOption( ChannelOption.SO_RCVBUF, bufferSize ); // FlameCord
|
|
+ ch.config().setOption( ChannelOption.SO_SNDBUF, bufferSize ); // FlameCord
|
|
ch.config().setOption( ChannelOption.TCP_NODELAY, true );
|
|
ch.config().setAllocator( PooledByteBufAllocator.DEFAULT );
|
|
ch.config().setWriteBufferWaterMark( MARK );
|
|
diff --git a/query/src/main/java/net/md_5/bungee/query/RemoteQuery.java b/query/src/main/java/net/md_5/bungee/query/RemoteQuery.java
|
|
index 8becc26a..8304685c 100644
|
|
--- a/query/src/main/java/net/md_5/bungee/query/RemoteQuery.java
|
|
+++ b/query/src/main/java/net/md_5/bungee/query/RemoteQuery.java
|
|
@@ -1,5 +1,6 @@
|
|
package net.md_5.bungee.query;
|
|
|
|
+import io.netty.channel.ChannelOption;
|
|
import io.netty.bootstrap.Bootstrap;
|
|
import io.netty.channel.Channel;
|
|
import io.netty.channel.ChannelFutureListener;
|
|
@@ -18,11 +19,15 @@ public class RemoteQuery
|
|
|
|
public void start(Class<? extends Channel> channel, InetSocketAddress address, EventLoopGroup eventLoop, ChannelFutureListener future)
|
|
{
|
|
+ int bufferSize = 65536; // FlameCord
|
|
+
|
|
new Bootstrap()
|
|
.channel( channel )
|
|
.group( eventLoop )
|
|
.handler( new QueryHandler( bungee, listener ) )
|
|
.localAddress( address )
|
|
+ .option(ChannelOption.SO_RCVBUF, bufferSize) // FlameCord
|
|
+ .option(ChannelOption.SO_SNDBUF, bufferSize) // FlameCord
|
|
.bind().addListener( future );
|
|
}
|
|
}
|
|
--
|
|
2.31.1
|
|
|