Helius
2021-02-24 5285d249e702eeab3ad3847aaa24523ef0f1a544
src/main/java/com/xcong/excoin/netty/handler/WebSocketServerHandler.java
@@ -61,7 +61,7 @@
    @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)");