writebuffer watermark

This commit is contained in:
creeper123123321 2021-04-02 12:13:40 -03:00
parent ff198c9adc
commit c51aaf0510
3 changed files with 5 additions and 5 deletions

View File

@ -19,10 +19,7 @@ import io.ktor.network.tls.certificates.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.netty.bootstrap.ServerBootstrap
import io.netty.channel.ChannelFactory
import io.netty.channel.ChannelFuture
import io.netty.channel.ChannelOption
import io.netty.channel.EventLoopGroup
import io.netty.channel.*
import io.netty.channel.epoll.Epoll
import io.netty.channel.epoll.EpollEventLoopGroup
import io.netty.channel.epoll.EpollServerSocketChannel
@ -63,6 +60,7 @@ val httpClient = HttpClient {
}
}
val initFuture = CompletableFuture<Unit>()
val bufferWaterMark = WriteBufferWaterMark(512 * 1024, 2048 * 1024)
// Minecraft doesn't have forward secrecy
val mcCryptoKey = KeyPairGenerator.getInstance("RSA").let {
@ -173,6 +171,7 @@ private fun bindPorts(args: Array<String>) {
.group(parentLoop, childLoop)
.channelFactory(channelServerSocketFactory(parentLoop))
.childHandler(FrontEndInit)
.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, bufferWaterMark)
.childOption(ChannelOption.IP_TOS, 0x18)
.childOption(ChannelOption.TCP_NODELAY, true)
.bind(InetAddress.getByName(VIAaaSConfig.bindAddress), VIAaaSConfig.port)

View File

@ -25,6 +25,7 @@ private fun createBackChannel(handler: MinecraftHandler, socketAddr: InetSocketA
.handler(BackEndInit(handler.data))
.channelFactory(channelSocketFactory(loop.parent()))
.group(loop)
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, bufferWaterMark)
.option(ChannelOption.IP_TOS, 0x18)
.option(ChannelOption.TCP_NODELAY, true)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) // We need to show the error before the client timeout

View File

@ -24,7 +24,7 @@
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="all">
<Root level="debug">
<AppenderRef level="info" ref="TerminalConsole"/>
<AppenderRef level="info" ref="File"/>
<AppenderRef level="debug" ref="DebugFile"/>