From 0dcba4fd1cb536ab426622e31213d8a0194449ff Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 25 四月 2025 14:12:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/ChannelMap.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/ChannelMap.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/ChannelMap.java
index 49e8521..ef8d07b 100644
--- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/ChannelMap.java
+++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/netty/client/ChannelMap.java
@@ -34,8 +34,9 @@
 	 * @param key
 	 * @param channel
 	 */
-	public static void addClientChannel(int key, ChannelId channel) {
-		CLIENT_ID_MAP.put(key, channel);
+	public static void addClientChannel(int key, Channel channel) {
+		CLIENT_ID_MAP.put(key, channel.id());
+		CLIENT_GROUP.add(channel);
 	}
 	
 	
@@ -47,6 +48,9 @@
 	 */
 	public static Channel getClientChannel(int key) {
 		ChannelId channelId = CLIENT_ID_MAP.get(key);
+		if (null == channelId) {
+			return null;
+		}
 		Channel channel = CLIENT_GROUP.find(channelId);
 		return channel;
 	}
@@ -58,8 +62,9 @@
 	 * @param key
 	 * @param channel
 	 */
-	public static void addServerChannel(int key, ChannelId channel) {
-		SERVER_ID_MAP.put(key, channel);
+	public static void addServerChannel(int key, Channel channel) {
+		SERVER_ID_MAP.put(key, channel.id());
+		SERVER_GROUP.add(channel);
 	}
 	
 	
@@ -71,6 +76,9 @@
 	 */
 	public static Channel getServerChannel(int key) {
 		ChannelId channelId = SERVER_ID_MAP.get(key);
+		if (null == channelId) {
+			return null;
+		}
 		Channel channel = SERVER_GROUP.find(channelId);
 		return channel;
 	}

--
Gitblit v1.7.1