Commit 1dfaf950 by tiger

login

1 parent c1b14ba1
...@@ -49,7 +49,6 @@ public class TcpClient { ...@@ -49,7 +49,6 @@ public class TcpClient {
protected void initChannel(SocketChannel ch) throws Exception { protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline(); ChannelPipeline pipeline = ch.pipeline();
// pipeline.addLast("lengthEncoder", new LengthFieldPrepender(4));
pipeline.addLast("lengthDecoder", new LengthFieldBasedFrameDecoder(PROTOCOL_MAX_LENGTH, 1, 1, 2, 0)); pipeline.addLast("lengthDecoder", new LengthFieldBasedFrameDecoder(PROTOCOL_MAX_LENGTH, 1, 1, 2, 0));
pipeline.addLast("decoder", new ByteArrayDecoder()); pipeline.addLast("decoder", new ByteArrayDecoder());
pipeline.addLast("encoder", new ByteArrayEncoder()); pipeline.addLast("encoder", new ByteArrayEncoder());
......
...@@ -56,7 +56,6 @@ public class TcpServer { ...@@ -56,7 +56,6 @@ public class TcpServer {
public void initChannel(SocketChannel ch) throws Exception { public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline(); ChannelPipeline pipeline = ch.pipeline();
// pipeline.addLast("lengthEncoder", new LengthFieldPrepender(4));
pipeline.addLast("lengthDecoder", new LengthFieldBasedFrameDecoder(PROTOCOL_MAX_LENGTH, 1, 1, 2, 0)); pipeline.addLast("lengthDecoder", new LengthFieldBasedFrameDecoder(PROTOCOL_MAX_LENGTH, 1, 1, 2, 0));
pipeline.addLast("decoder", new ByteArrayDecoder()); pipeline.addLast("decoder", new ByteArrayDecoder());
pipeline.addLast("encoder", new ByteArrayEncoder()); pipeline.addLast("encoder", new ByteArrayEncoder());
......
...@@ -8,6 +8,7 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpBase; ...@@ -8,6 +8,7 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpBase;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpData; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpData;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpHandler; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpHandler;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpMapper; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpMapper;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpReq;
import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.handler.DefaultReqHandler; import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.handler.DefaultReqHandler;
import cn.com.glsx.charging.util.ByteUtils; import cn.com.glsx.charging.util.ByteUtils;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
...@@ -77,7 +78,7 @@ public class TcpServerHandler extends SimpleChannelInboundHandler<byte[]> { ...@@ -77,7 +78,7 @@ public class TcpServerHandler extends SimpleChannelInboundHandler<byte[]> {
log.info("up:{}", up); log.info("up:{}", up);
Class<? extends TcpHandler> handlerClass = mapper.getHandlerClass(); Class<? extends TcpHandler> handlerClass = mapper.getHandlerClass();
if (handlerClass == null) { if (handlerClass == null && up instanceof TcpReq) {
handlerClass = DefaultReqHandler.class; handlerClass = DefaultReqHandler.class;
} }
if (handlerClass == null) { if (handlerClass == null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!