|
@@ -50,7 +50,7 @@ public class DiscardServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
|
public static Map<String, String> channelMap = new HashMap<String, String>();
|
|
|
public static Map<String, Channel> manageChannelMap = new HashMap<>();
|
|
|
- public static Map<Channel, String> channelMapOfChannelKey = new HashMap<>();
|
|
|
+ public static Map<String, Channel> channelMapOfChannelKey = new HashMap<>();
|
|
|
public static Map<String, String> commandCopy = new HashMap<>();
|
|
|
|
|
|
@Autowired
|
|
@@ -73,8 +73,8 @@ public class DiscardServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
String deviceId = advice.getDeviceId();
|
|
|
String adviceType = advice.getAdviceType();
|
|
|
Channel channel = ctx.channel();
|
|
|
- String deviceIdInMap = channelMapOfChannelKey.get(channel);
|
|
|
- if (deviceIdInMap == null) {
|
|
|
+ Channel channelInMap = channelMapOfChannelKey.get(deviceId);
|
|
|
+ if (channelInMap == null) {
|
|
|
manageLink(channel, deviceId);
|
|
|
}
|
|
|
switch (adviceType) {
|
|
@@ -106,7 +106,7 @@ public class DiscardServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
String channelId = UUID.randomUUID().toString();
|
|
|
manageChannelMap.put(channelId, channel);
|
|
|
channelMap.put(channelId, deviceId);
|
|
|
- channelMapOfChannelKey.put(channel, deviceId);
|
|
|
+ channelMapOfChannelKey.put(deviceId, channel);
|
|
|
logger.info("链接管理,链接id [{}]", channelId);
|
|
|
|
|
|
ConnectMsg cMsg = new ConnectMsg("10.27.118.76", channelId);
|