@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { Channel session = ctx.channel(); if ((firewall.getClientType(session) != ClientType.MIS) && (firewall.isBlocked(session))) { String remoteIp = sessionManager.getRemoteIp(session); Long playerId = sessionManager.getPlayerId(session); LOGGER.error( String.format("In blacklist: [ip: %s, playerId: %d]", new Object[] {remoteIp, playerId})); sessionManager.closeSession(session); return; } ctx.fireChannelRegistered(); }
@Override public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception { Channel session = ctx.channel(); if ((firewall.getClientType(session) != ClientType.MIS) && (firewall.blockedByPacks(ctx.channel(), 1))) { String remoteIp = sessionManager.getRemoteIp(session); long playerId = sessionManager.getPlayerId(session).longValue(); LOGGER.error( String.format( "In blacklist: [ip: %s, playerId: %d]", new Object[] {remoteIp, Long.valueOf(playerId)})); sessionManager.closeSession(session); return; } ctx.fireChannelRead(msg); }