mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 21:37:56 +08:00
[fix] 通信通道统一绑定客户端ID,访客ID
This commit is contained in:
parent
576498afc7
commit
9784cc65b6
@ -11,6 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.Abstrac
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ public class ClientHandleDistributeClientTransferClientPermeateChannelConnection
|
|||||||
String visitorId=new String(msgVisitorId);
|
String visitorId=new String(msgVisitorId);
|
||||||
Integer visitorPort=Integer.parseInt(new String(msgVisitorPort));
|
Integer visitorPort=Integer.parseInt(new String(msgVisitorPort));
|
||||||
NettyClientProperties nettyClientProperties = SpringContextHolder.getBean(NettyClientProperties.class);
|
NettyClientProperties nettyClientProperties = SpringContextHolder.getBean(NettyClientProperties.class);
|
||||||
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values().stream().collect(Collectors.toList());
|
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = new ArrayList<>(SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values());
|
||||||
NettyClientPermeateClientRealSocket.buildRealServer(
|
NettyClientPermeateClientRealSocket.buildRealServer(
|
||||||
clientId,
|
clientId,
|
||||||
clientTargetIp,
|
clientTargetIp,
|
||||||
|
@ -50,11 +50,10 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInboun
|
|||||||
// 当前通道绑定访客ID
|
// 当前通道绑定访客ID
|
||||||
ChannelAttributeKeyUtils.buildVisitorId(visitorChannel, visitorId);
|
ChannelAttributeKeyUtils.buildVisitorId(visitorChannel, visitorId);
|
||||||
|
|
||||||
internalNetworkClientPermeateClientVisitor.setVisitorId(visitorId);
|
|
||||||
// 判断是否有可用的通道 如果没有创建新的通道
|
// 判断是否有可用的通道 如果没有创建新的通道
|
||||||
// Channel transferChannel = nettyChannelPool.availableChannel(visitorId);
|
// Channel transferChannel = nettyChannelPool.availableChannel(visitorId);
|
||||||
// 创建访客连接客户端通道
|
// 创建访客连接客户端通道
|
||||||
NettyClientPermeateClientVisitorTransferSocket.buildTransferServer(internalNetworkClientPermeateClientVisitor);
|
NettyClientPermeateClientVisitorTransferSocket.buildTransferServer(internalNetworkClientPermeateClientVisitor,visitorChannel);
|
||||||
log.info("客户端渗透客户端访客端口连接成功了");
|
log.info("客户端渗透客户端访客端口连接成功了");
|
||||||
super.channelActive(ctx);
|
super.channelActive(ctx);
|
||||||
}
|
}
|
||||||
|
@ -28,18 +28,9 @@ public class NettyClientPermeateClientVisitorTransferSocket {
|
|||||||
/**
|
/**
|
||||||
* 连接服务端通信通道
|
* 连接服务端通信通道
|
||||||
*/
|
*/
|
||||||
public static void buildTransferServer(InternalNetworkClientPermeateClientVisitor internalNetworkClientPermeateClientVisitor) {
|
public static void buildTransferServer(InternalNetworkClientPermeateClientVisitor internalNetworkClientPermeateClientVisitor,Channel visitorChannel) {
|
||||||
newTransferConnect2Server(internalNetworkClientPermeateClientVisitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 连接服务端通信通道
|
|
||||||
* <p>
|
|
||||||
* internalNetworkPermeateServerVisitor
|
|
||||||
*/
|
|
||||||
protected static void newTransferConnect2Server(InternalNetworkClientPermeateClientVisitor internalNetworkClientPermeateClientVisitor) {
|
|
||||||
|
|
||||||
Bootstrap bootstrap = new Bootstrap();
|
Bootstrap bootstrap = new Bootstrap();
|
||||||
bootstrap.group(eventLoopGroup)
|
bootstrap.group(eventLoopGroup)
|
||||||
.channel(NioSocketChannel.class)
|
.channel(NioSocketChannel.class)
|
||||||
@ -66,7 +57,7 @@ public class NettyClientPermeateClientVisitorTransferSocket {
|
|||||||
String targetIp = internalNetworkClientPermeateClientVisitor.getTargetIp();
|
String targetIp = internalNetworkClientPermeateClientVisitor.getTargetIp();
|
||||||
Integer targetPort = internalNetworkClientPermeateClientVisitor.getTargetPort();
|
Integer targetPort = internalNetworkClientPermeateClientVisitor.getTargetPort();
|
||||||
|
|
||||||
String visitorId = internalNetworkClientPermeateClientVisitor.getVisitorId();
|
String visitorId = ChannelAttributeKeyUtils.getVisitorId(visitorChannel);
|
||||||
Integer visitorPort = internalNetworkClientPermeateClientVisitor.getVisitorPort();
|
Integer visitorPort = internalNetworkClientPermeateClientVisitor.getVisitorPort();
|
||||||
String toClientId = internalNetworkClientPermeateClientVisitor.getToClientId();
|
String toClientId = internalNetworkClientPermeateClientVisitor.getToClientId();
|
||||||
|
|
||||||
@ -94,17 +85,15 @@ public class NettyClientPermeateClientVisitorTransferSocket {
|
|||||||
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
|
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
|
||||||
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
||||||
// 传输通道打开后自动读取
|
// 传输通道打开后自动读取
|
||||||
Channel visitor = NettyRealIdContext.getReal(visitorId);
|
ChannelAttributeKeyUtils.buildNextChannel(visitorChannel, transferChannel);
|
||||||
|
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, visitorChannel);
|
||||||
ChannelAttributeKeyUtils.buildNextChannel(visitor, transferChannel);
|
|
||||||
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, visitor);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.info("无法连接到服务端....");
|
log.info("无法连接到服务端....");
|
||||||
transferChannel.eventLoop().schedule(() -> {
|
transferChannel.eventLoop().schedule(() -> {
|
||||||
try {
|
try {
|
||||||
buildTransferServer(internalNetworkClientPermeateClientVisitor);
|
buildTransferServer(internalNetworkClientPermeateClientVisitor,visitorChannel);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -212,6 +212,8 @@ public class MessageType {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发 客户端接收连接成功通知
|
* 下发 客户端接收连接成功通知
|
||||||
*
|
*
|
||||||
@ -270,7 +272,7 @@ public class MessageType {
|
|||||||
* @see MessageTypeEnums#DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR
|
* @see MessageTypeEnums#DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR
|
||||||
* @see AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced
|
* @see AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced
|
||||||
*/
|
*/
|
||||||
public static final byte DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR = -0X08;
|
public static final byte DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR = -0X08;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发 客户端消息
|
* 下发 客户端消息
|
||||||
|
@ -156,7 +156,7 @@ public enum MessageTypeEnums {
|
|||||||
/**
|
/**
|
||||||
* @see AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced
|
* @see AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced
|
||||||
*/
|
*/
|
||||||
DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR(MessageType.DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR, "下发 客户端关闭代理服务通道"),
|
DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR(MessageType.DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR, "下发 客户端关闭代理服务通道"),
|
||||||
/**
|
/**
|
||||||
* @see AbstractHandleDistributeSingleClientMessageTypeAdvanced
|
* @see AbstractHandleDistributeSingleClientMessageTypeAdvanced
|
||||||
*/
|
*/
|
||||||
|
@ -4,6 +4,7 @@ import io.netty.channel.Channel;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.*;
|
import org.framework.lazy.cloud.network.heartbeat.common.*;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,19 +16,22 @@ public class ServerHandleReportClientTransferClientPermeateChannelConnectionSucc
|
|||||||
/**
|
/**
|
||||||
* 处理当前数据
|
* 处理当前数据
|
||||||
*
|
*
|
||||||
* @param channel 当前通道
|
* @param transferChannel 当前通道
|
||||||
* @param nettyProxyMsg 通道数据
|
* @param nettyProxyMsg 通道数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
|
protected void doHandler(Channel transferChannel, NettyProxyMsg nettyProxyMsg) {
|
||||||
// 创建目标地址连接
|
// 创建目标地址连接
|
||||||
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
|
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
|
||||||
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
|
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
|
||||||
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
|
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
|
||||||
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
|
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
|
||||||
byte[] clientId = nettyProxyMsg.getClientId();// 目标客户端ID
|
byte[] clientId = nettyProxyMsg.getClientId();// 目标客户端ID
|
||||||
|
|
||||||
|
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
||||||
|
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, msgVisitorId);
|
||||||
// 绑定访客通道
|
// 绑定访客通道
|
||||||
NettyTransferChannelContext.pushVisitor(channel,msgVisitorId);
|
NettyTransferChannelContext.pushVisitor(transferChannel,msgVisitorId);
|
||||||
ChannelContext.ClientChannel clientChannel = ChannelContext.get(clientId);
|
ChannelContext.ClientChannel clientChannel = ChannelContext.get(clientId);
|
||||||
|
|
||||||
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
|
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
|
||||||
|
@ -18,11 +18,11 @@ public class ServerHandleReportClientTransferClientPermeateChannelInitSuccessful
|
|||||||
/**
|
/**
|
||||||
* 处理当前数据
|
* 处理当前数据
|
||||||
*
|
*
|
||||||
* @param channel 当前通道
|
* @param transferChannel 当前通道
|
||||||
* @param nettyProxyMsg 通道数据
|
* @param nettyProxyMsg 通道数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
|
protected void doHandler(Channel transferChannel, NettyProxyMsg nettyProxyMsg) {
|
||||||
// 创建目标地址连接
|
// 创建目标地址连接
|
||||||
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
|
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
|
||||||
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
|
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
|
||||||
@ -33,11 +33,12 @@ public class ServerHandleReportClientTransferClientPermeateChannelInitSuccessful
|
|||||||
|
|
||||||
// next translation
|
// next translation
|
||||||
Channel nextTransferChannel = NettyTransferChannelContext.getVisitor(msgVisitorId);
|
Channel nextTransferChannel = NettyTransferChannelContext.getVisitor(msgVisitorId);
|
||||||
ChannelAttributeKeyUtils.buildTransferNextChannel(nextTransferChannel,channel);
|
ChannelAttributeKeyUtils.buildTransferNextChannel(nextTransferChannel,transferChannel);
|
||||||
ChannelAttributeKeyUtils.buildTransferNextChannel(channel,nextTransferChannel);
|
ChannelAttributeKeyUtils.buildTransferNextChannel(transferChannel,nextTransferChannel);
|
||||||
NettyTransferChannelContext.clear(msgVisitorId);
|
ChannelAttributeKeyUtils.buildClientId(transferChannel,clientId);
|
||||||
|
ChannelAttributeKeyUtils.buildVisitorId(transferChannel,msgVisitorId);
|
||||||
|
|
||||||
Channel nextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(channel);
|
Channel nextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(transferChannel);
|
||||||
|
|
||||||
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
|
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
|
||||||
clientConnectTagetNettyProxyMsg.setVisitorId(msgVisitorId);
|
clientConnectTagetNettyProxyMsg.setVisitorId(msgVisitorId);
|
||||||
|
@ -3,6 +3,7 @@ package org.framework.lazy.cloud.network.heartbeat.server.netty.advanced;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.socket.NettyClientPermeateServerConnectRealSocket;
|
import org.framework.lazy.cloud.network.heartbeat.server.netty.socket.NettyClientPermeateServerConnectRealSocket;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -24,6 +25,11 @@ public class ServerHandleReportClientTransferServerPermeateChannelConnectionSucc
|
|||||||
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
|
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
|
||||||
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
|
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
|
||||||
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
|
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
|
||||||
|
byte[] msgClientId = nettyProxyMsg.getClientId();
|
||||||
|
String clientId = new String(msgClientId);
|
||||||
|
// 绑定客户端ID
|
||||||
|
ChannelAttributeKeyUtils.buildClientId(transferChannel,clientId);
|
||||||
|
ChannelAttributeKeyUtils.buildVisitorId(transferChannel,msgVisitorId);
|
||||||
NettyClientPermeateServerConnectRealSocket.buildNewRealServer(new String(msgVisitorId),
|
NettyClientPermeateServerConnectRealSocket.buildNewRealServer(new String(msgVisitorId),
|
||||||
Integer.parseInt(new String(msgVisitorPort)),
|
Integer.parseInt(new String(msgVisitorPort)),
|
||||||
new String(msgClientTargetIp),
|
new String(msgClientTargetIp),
|
||||||
|
@ -4,13 +4,13 @@ import io.netty.channel.*;
|
|||||||
import io.netty.handler.timeout.IdleState;
|
import io.netty.handler.timeout.IdleState;
|
||||||
import io.netty.handler.timeout.IdleStateEvent;
|
import io.netty.handler.timeout.IdleStateEvent;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.wu.framework.core.utils.ObjectUtils;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
|
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
|
import org.wu.framework.core.utils.ObjectUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* description 服务端数据处理器
|
* description 服务端数据处理器
|
||||||
@ -66,7 +66,7 @@ public class NettyServerHandler extends SimpleChannelInboundHandler<NettyProxyMs
|
|||||||
|
|
||||||
if (ObjectUtils.isEmpty(visitorId)) {
|
if (ObjectUtils.isEmpty(visitorId)) {
|
||||||
// 关闭这个不活跃的channel client:{}
|
// 关闭这个不活跃的channel client:{}
|
||||||
log.warn("Close this inactive channel client: {}", clientId);
|
log.warn("Close this inactive channel client:{} with no visitor", clientId);
|
||||||
// 给所有客户端发送 这个客户端离线了
|
// 给所有客户端发送 这个客户端离线了
|
||||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||||
nettyMsg.setClientId(clientId);
|
nettyMsg.setClientId(clientId);
|
||||||
@ -77,6 +77,12 @@ public class NettyServerHandler extends SimpleChannelInboundHandler<NettyProxyMs
|
|||||||
log.warn("Close visitor: [{}]'s connection", visitorId);
|
log.warn("Close visitor: [{}]'s connection", visitorId);
|
||||||
NettyCommunicationIdContext.clear(visitorId);
|
NettyCommunicationIdContext.clear(visitorId);
|
||||||
NettyRealIdContext.clear(visitorId);
|
NettyRealIdContext.clear(visitorId);
|
||||||
|
// 关闭通信通道
|
||||||
|
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
|
||||||
|
Channel transferNextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(channel);
|
||||||
|
channel.close();
|
||||||
|
nextChannel.close();
|
||||||
|
transferNextChannel.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -107,13 +113,19 @@ public class NettyServerHandler extends SimpleChannelInboundHandler<NettyProxyMs
|
|||||||
|
|
||||||
if (!ObjectUtils.isEmpty(visitorId)) {
|
if (!ObjectUtils.isEmpty(visitorId)) {
|
||||||
// 客户端:{},断开访客的连接:{}
|
// 客户端:{},断开访客的连接:{}
|
||||||
log.warn("Client: {}, disconnect guest: {}", clientId, visitorId);
|
log.warn("Client: {}, disconnect guest:{}", clientId, visitorId);
|
||||||
// 访客通道 关闭访客通道
|
// 访客通道 关闭访客通道
|
||||||
NettyCommunicationIdContext.clear(visitorId);
|
NettyCommunicationIdContext.clear(visitorId);
|
||||||
|
// 关闭通信通道
|
||||||
|
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
|
||||||
|
Channel transferNextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(channel);
|
||||||
|
channel.close();
|
||||||
|
nextChannel.close();
|
||||||
|
transferNextChannel.close();
|
||||||
super.channelInactive(ctx);
|
super.channelInactive(ctx);
|
||||||
} else if (!ObjectUtils.isEmpty(clientId)) {
|
} else if (!ObjectUtils.isEmpty(clientId)) {
|
||||||
// 断开客户端的连接:{}
|
// 断开客户端的连接:{}
|
||||||
log.warn("Disconnect client: {}", clientId);
|
log.warn("Disconnect client:{}", clientId);
|
||||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||||
nettyMsg.setType(MessageType.REPORT_CLIENT_DISCONNECTION);
|
nettyMsg.setType(MessageType.REPORT_CLIENT_DISCONNECTION);
|
||||||
nettyMsg.setClientId(clientId);
|
nettyMsg.setClientId(clientId);
|
||||||
|
@ -137,7 +137,7 @@ public class NettyServerPermeateClientVisitorHandler extends SimpleChannelInboun
|
|||||||
|
|
||||||
// 通知服务端 关闭访问通道、真实通道
|
// 通知服务端 关闭访问通道、真实通道
|
||||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||||
myMsg.setType(MessageType.DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR);
|
myMsg.setType(MessageType.DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR);
|
||||||
myMsg.setVisitorId(visitorId);
|
myMsg.setVisitorId(visitorId);
|
||||||
nextChannel.writeAndFlush(myMsg);
|
nextChannel.writeAndFlush(myMsg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user