diff --git a/netty-pad/src/main/java/com/sv/netty/netty/ServerHandler.java b/netty-pad/src/main/java/com/sv/netty/netty/ServerHandler.java index 36d0e18..27dbc1b 100644 --- a/netty-pad/src/main/java/com/sv/netty/netty/ServerHandler.java +++ b/netty-pad/src/main/java/com/sv/netty/netty/ServerHandler.java @@ -113,16 +113,16 @@ public class ServerHandler extends SimpleChannelInboundHandler { @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { // 服务器统计现在有的客户端数量, 客户端这个方法用来发心跳 - if (evt instanceof IdleStateEvent){ - IdleState state = ((IdleStateEvent) evt).state(); - if (state == IdleState.READER_IDLE){ - logger.info("IdleStateEvent READER_IDLE 超时"); - Integer venueId = ctx.channel().attr(Constant.CHANNEL_PARAM).get().getVenueId(); - String deviceName = ctx.channel().attr(Constant.CHANNEL_PARAM).get().getDeviceName(); - messageService.Offline(deviceName,venueId); - ctx.channel().close(); - } - } +// if (evt instanceof IdleStateEvent){ +// IdleState state = ((IdleStateEvent) evt).state(); +// if (state == IdleState.READER_IDLE){ +// logger.info("IdleStateEvent READER_IDLE 超时"); +// Integer venueId = ctx.channel().attr(Constant.CHANNEL_PARAM).get().getVenueId(); +// String deviceName = ctx.channel().attr(Constant.CHANNEL_PARAM).get().getDeviceName(); +// messageService.Offline(deviceName,venueId); +// ctx.channel().close(); +// } +// } Set conns = messageService.countConnection(); logger.info("count connected device ! the count is " + conns.size() + " and they are + [" + conns.toString() + "]" ); }