yonge 2 rokov pred
rodič
commit
796d9b55a0

+ 8 - 0
audio-analysis/src/main/java/com/yonge/netty/server/handler/NettyChannelManager.java

@@ -10,14 +10,19 @@ import java.util.concurrent.ConcurrentMap;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import com.ym.mec.util.json.JsonUtil;
+import com.yonge.netty.server.service.UserChannelContextService;
 
 @Component
 public class NettyChannelManager {
 
 	private static final Logger LOGGER = LoggerFactory.getLogger(NettyChannelManager.class);
+	
+	@Autowired
+	private UserChannelContextService userChannelContextService;
 
 	/**
 	 * {@link Channel#attr(AttributeKey)} 属性中,表示 Channel 对应的用户
@@ -83,6 +88,9 @@ public class NettyChannelManager {
 	 * @param channel Channel
 	 */
 	public void remove(Channel channel) {
+		
+		userChannelContextService.remove(channel);
+		
 		// 移除 channels
 		channels.remove(channel.id());