服务端、客户端认证逻辑调整

This commit is contained in:
aoshiguchen
2023-06-03 01:34:22 +08:00
parent 5a3375ce80
commit 5a65eebfd3
@@ -93,19 +93,20 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
// 客户端切换网络后,连接断开,但服务端还未触发断开事件。此时客户端重连上了,然后服务端触发了断开,此时不应该更新在线状态
if (curCmdChannel == ctx.channel()) {
Solon.context().getBean(ProxyMutualService.class).offline(cmdChannelAttachInfo);
Solon.context().getBean(ClientConnectRecordService.class).add(new ClientConnectRecordDO()
.setIp(((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress())
.setLicenseId(cmdChannelAttachInfo.getLicenseId())
.setType(ClientConnectTypeEnum.DISCONNECT.getType())
.setMsg("")
.setCode(SuccessCodeEnum.SUCCESS.getCode())
.setCreateTime(new Date())
);
ProxyUtil.removeCmdChannel(ctx.channel());
// 防止下次换一个客户端,无法连接的情况
ProxyUtil.removeClientIdByLicenseId(cmdChannelAttachInfo.getLicenseId());
}
}
// 即便是因为上述原因断开,断开的日志依然要记录,方便排查问题
Solon.context().getBean(ClientConnectRecordService.class).add(new ClientConnectRecordDO()
.setIp(((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress())
.setLicenseId(cmdChannelAttachInfo.getLicenseId())
.setType(ClientConnectTypeEnum.DISCONNECT.getType())
.setMsg("")
.setCode(SuccessCodeEnum.SUCCESS.getCode())
.setCreateTime(new Date())
);
}
super.channelInactive(ctx);