Increase socket send buffer to 1MB

This commit is contained in:
themode 2020-11-19 08:29:34 +01:00
parent c1e623eddc
commit 099a8bafdc
2 changed files with 3 additions and 2 deletions

View File

@ -65,6 +65,7 @@ public class NettyServer {
protected void initChannel(@NotNull SocketChannel ch) {
ChannelConfig config = ch.config();
config.setOption(ChannelOption.TCP_NODELAY, true);
config.setOption(ChannelOption.SO_SNDBUF, 1_000_000);
ChannelPipeline pipeline = ch.pipeline();

View File

@ -101,9 +101,9 @@ public class NettyPlayerConnection extends PlayerConnection {
public void sendPacket(@NotNull ServerPacket serverPacket) {
if (shouldSendPacket(serverPacket)) {
if (getPlayer() != null) {
channel.write(serverPacket); // Flush on player update
this.channel.write(serverPacket); // Flush on player update
} else {
channel.writeAndFlush(serverPacket);
this.channel.writeAndFlush(serverPacket);
}
}
}