From d3cdbf19b53e24a1417364b098f7b8f71f36a208 Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Sun, 28 Feb 2021 19:47:04 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/netty/handler/WebSocketServerHandler.java | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/xcong/excoin/netty/handler/WebSocketServerHandler.java b/src/main/java/com/xcong/excoin/netty/handler/WebSocketServerHandler.java index 3e57246..2c9c019 100644 --- a/src/main/java/com/xcong/excoin/netty/handler/WebSocketServerHandler.java +++ b/src/main/java/com/xcong/excoin/netty/handler/WebSocketServerHandler.java @@ -1,7 +1,7 @@ package com.xcong.excoin.netty.handler; -import com.xcong.excoin.netty.common.ChannelManager; +import com.xcong.excoin.netty.common.ServerChannelManager; import com.xcong.excoin.netty.common.Contans; import com.xcong.excoin.netty.common.NettyTools; import com.xcong.excoin.netty.dispatch.MsgDispatch; @@ -50,18 +50,18 @@ @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { log.info("[websocket客户端连入服务器]-->{}", ctx.channel().id()); - ChannelManager.addWebSocketChannel(ctx.channel()); + ServerChannelManager.addWebSocketChannel(ctx.channel()); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { log.info("[离开websocket服务器]-->{}", ctx.channel().id()); - ChannelManager.removeWebSocketChannel(ctx.channel()); + ServerChannelManager.removeWebSocketChannel(ctx.channel()); } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { -// LogUtil.info("[websocket服务器收到消息]-->{}, {}", ctx.channel().id(), msg); +// log.info("[websocket服务器收到消息]-->{}, {}", ctx.channel().id(), msg); if (msg instanceof FullHttpRequest) { // 以http请求形式接入,但是走的是websocket handleHttpRequest(ctx, (FullHttpRequest) msg); @@ -88,7 +88,6 @@ @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { log.info("[触发器触发]"); -// super.userEventTriggered(ctx, evt); if (evt instanceof IdleStateEvent) { IdleStateEvent event = (IdleStateEvent) evt; if (event.state() == IdleState.READER_IDLE) { @@ -101,7 +100,7 @@ times = 0; } /*读超时*/ - log.info("===服务端===({}写超时, {})", ctx.channel().id().asShortText(), times); +// log.info("===服务端===({}写超时, {})", ctx.channel().id().asShortText(), times); // 失败计数器次数大于等于3次的时候,关闭链接,等待client重连 if (times >= MAX_UN_REC_PING_TIMES) { log.info("===服务端===(写超时,关闭chanel)"); -- Gitblit v1.9.1