mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-28 03:57:50 +01:00
A few internal comments
This commit is contained in:
parent
ae845e38ab
commit
79a5f99358
@ -32,11 +32,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
public final class NettyServer {
|
||||
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(NettyServer.class);
|
||||
|
||||
private static final long DEFAULT_COMPRESSED_CHANNEL_WRITE_LIMIT = 600_000L;
|
||||
private static final long DEFAULT_COMPRESSED_CHANNEL_READ_LIMIT = 100_000L;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(NettyServer.class);
|
||||
|
||||
private static final long DEFAULT_UNCOMPRESSED_CHANNEL_WRITE_LIMIT = 15_000_000L;
|
||||
private static final long DEFAULT_UNCOMPRESSED_CHANNEL_READ_LIMIT = 1_000_000L;
|
||||
|
||||
@ -79,28 +79,28 @@ public final class NettyServer {
|
||||
|
||||
channel = IOUringServerSocketChannel.class;
|
||||
|
||||
log.info("Using Io_uring");
|
||||
LOGGER.info("Using io_uring");
|
||||
} else if (Epoll.isAvailable()) {
|
||||
boss = new EpollEventLoopGroup(2);
|
||||
worker = new EpollEventLoopGroup(); // thread count = core * 2
|
||||
|
||||
channel = EpollServerSocketChannel.class;
|
||||
|
||||
log.info("Using Epoll");
|
||||
LOGGER.info("Using epoll");
|
||||
} else if (KQueue.isAvailable()) {
|
||||
boss = new KQueueEventLoopGroup(2);
|
||||
worker = new KQueueEventLoopGroup(); // thread count = core * 2
|
||||
|
||||
channel = KQueueServerSocketChannel.class;
|
||||
|
||||
log.info("Using KQueue");
|
||||
LOGGER.info("Using kqueue");
|
||||
} else {
|
||||
boss = new NioEventLoopGroup(2);
|
||||
worker = new NioEventLoopGroup(); // thread count = core * 2
|
||||
|
||||
channel = NioServerSocketChannel.class;
|
||||
|
||||
log.info("Using Nio");
|
||||
LOGGER.info("Using NIO");
|
||||
}
|
||||
|
||||
bootstrap = new ServerBootstrap()
|
||||
|
@ -48,9 +48,12 @@ public final class PacketUtils {
|
||||
final ByteBuf finalBuffer = createFramedPacket(packet, true);
|
||||
final FramedPacket framedPacket = new FramedPacket(finalBuffer);
|
||||
|
||||
// Prevent premature release
|
||||
final int refIncrease = players.size() - 1;
|
||||
if (refIncrease > 0)
|
||||
finalBuffer.retain(refIncrease);
|
||||
|
||||
// Send packet to all players
|
||||
for (Player player : players) {
|
||||
final PlayerConnection playerConnection = player.getPlayerConnection();
|
||||
if (playerConnection instanceof NettyPlayerConnection) {
|
||||
|
Loading…
Reference in New Issue
Block a user