Browse Source

康凯斯接口调整 如果device_id 不存在,且不是登报 则断开连接

jianghouwei 6 years ago
parent
commit
21354466eb

+ 5 - 3
src/main/java/com/tidecloud/dataacceptance/service/impl/GK309GpsServerHandler.java

@@ -88,13 +88,15 @@ public class GK309GpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
 
 	private void handle(ByteBuf in, int length, Channel channel) throws Exception {
 		if (in.isReadable()) {
+			byte msgType = in.readByte();// 协议号 1个字节
 			String deviceId = channelDeviceMap.get(channel);
 			if (deviceId != null) {
 				MDC.put(MDC_DEVICEID, deviceId);
-			}else{
-				channel.close();
+			} else {
+				if (LOGIN_MSG != msgType) {
+					channel.close();
+				}
 			}
-			byte msgType = in.readByte();// 协议号 1个字节
 			if (LOGIN_MSG == msgType) {
 				resolveLoginMSG(in, channel);
 			} else if (STATUS_MSG == msgType) {