Search in sources :

Example 1 with LegacyPingHandler

use of net.glowstone.net.handler.legacyping.LegacyPingHandler in project Glowstone by GlowstoneMC.

the class GlowChannelInitializer method initChannel.

@Override
protected void initChannel(SocketChannel c) {
    MessageHandler handler = new MessageHandler(connectionManager);
    CodecsHandler codecs = new CodecsHandler(ProtocolType.HANDSHAKE.getProtocol());
    FramingHandler framing = new FramingHandler();
    try {
        c.config().setOption(ChannelOption.IP_TOS, 0x18);
    } catch (ChannelException e) {
        // Not supported on all OSs, like Windows XP and lesser
        GlowServer.logger.warning("Your OS does not support type of service.");
    }
    c.config().setAllocator(PooledByteBufAllocator.DEFAULT);
    c.pipeline().addLast("idle_timeout", new IdleStateHandler(READ_IDLE_TIMEOUT, WRITE_IDLE_TIMEOUT, 0)).addLast("legacy_ping", new LegacyPingHandler(connectionManager)).addLast("encryption", NoopHandler.INSTANCE).addLast("framing", framing).addLast("compression", NoopHandler.INSTANCE).addLast("codecs", codecs).addLast("handler", handler);
}
Also used : LegacyPingHandler(net.glowstone.net.handler.legacyping.LegacyPingHandler) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) ChannelException(io.netty.channel.ChannelException)

Aggregations

ChannelException (io.netty.channel.ChannelException)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 LegacyPingHandler (net.glowstone.net.handler.legacyping.LegacyPingHandler)1