mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Disable TCP_NO_DELAY by default
This commit is contained in:
parent
437afc28ff
commit
16ad864c09
@ -63,6 +63,8 @@ public final class NettyServer {
|
||||
private final PacketProcessor packetProcessor;
|
||||
private final GlobalChannelTrafficShapingHandler globalTrafficHandler;
|
||||
|
||||
private boolean tcpNoDelay = false;
|
||||
|
||||
private EventLoopGroup boss, worker;
|
||||
private ServerBootstrap bootstrap;
|
||||
|
||||
@ -158,7 +160,7 @@ public final class NettyServer {
|
||||
bootstrap.childHandler(new ChannelInitializer<SocketChannel>() {
|
||||
protected void initChannel(@NotNull SocketChannel ch) {
|
||||
ChannelConfig config = ch.config();
|
||||
config.setOption(ChannelOption.TCP_NODELAY, true);
|
||||
config.setOption(ChannelOption.TCP_NODELAY, tcpNoDelay);
|
||||
config.setOption(ChannelOption.SO_SNDBUF, 262_144);
|
||||
config.setAllocator(ByteBufAllocator.DEFAULT);
|
||||
|
||||
@ -254,6 +256,14 @@ public final class NettyServer {
|
||||
return globalTrafficHandler;
|
||||
}
|
||||
|
||||
public boolean isTcpNoDelay() {
|
||||
return tcpNoDelay;
|
||||
}
|
||||
|
||||
public void setTcpNoDelay(boolean tcpNoDelay) {
|
||||
this.tcpNoDelay = tcpNoDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the server and the various services.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user