|
@@ -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) {
|