From de026326a9df6f4a2192e99cf0e53e7e7b6d445d Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Fri, 24 Oct 2025 17:29:33 +0800
Subject: [PATCH] 1.整理文件管理文件路径。 2.新增航线信息接口业务。 3.优化KMZ文件接口业务逻辑。 4.pom文件修改。 5.增加业务工具类。 6.增加部分业务注解。 7.增加修改无人机状态方法。
---
ard-work/src/main/java/com/ard/work/component/netty/handler/ClientHandler.java | 25 +++++--------------------
1 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/ard-work/src/main/java/com/ard/work/component/netty/handler/ClientHandler.java b/ard-work/src/main/java/com/ard/work/component/netty/handler/ClientHandler.java
index c3eab84..278a558 100644
--- a/ard-work/src/main/java/com/ard/work/component/netty/handler/ClientHandler.java
+++ b/ard-work/src/main/java/com/ard/work/component/netty/handler/ClientHandler.java
@@ -1,22 +1,19 @@
package com.ard.work.component.netty.handler;
-import com.ard.work.component.netty.TyTcpClientManager;
-import com.ard.work.component.netty.command.register.HeartbeatCmd;
-import com.ard.work.domain.cache.TyTcpServerCache;
import com.ard.work.component.netty.command.BaseCmd;
+import com.ard.work.component.netty.command.register.HeartbeatCmd;
+import com.ard.work.component.netty.cache.TyTcpServerCache;
import com.ard.work.service.ITyService;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.AttributeKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.net.InetSocketAddress;
-import java.util.concurrent.TimeUnit;
@Component
@@ -26,9 +23,6 @@
@Resource
private ITyService tyService;
-
- @Resource
- private TyTcpClientManager tyTcpClientManager;
@Override
public void channelRead0(ChannelHandlerContext ctx, BaseCmd command) {
@@ -74,7 +68,7 @@
// 写空闲时主动发心跳
HeartbeatCmd heartbeat = new HeartbeatCmd(timestamp);
ctx.writeAndFlush(heartbeat);
- log.debug("写空闲 -> 发送心跳包 时间戳={}", timestamp);
+ log.info("写空闲 -> 发送心跳包 时间戳={}", timestamp);
break;
case ALL_IDLE:
log.info("读写都空闲 - 可考虑关闭连接或重连");
@@ -92,17 +86,8 @@
InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress();
String host = remoteAddress.getHostString();
int port = remoteAddress.getPort();
- log.error("与六合服务{}:{}连接断开!", host, port);
- TyTcpServerCache.putTcpServerCache(host + ":" + port, false);
- ctx.channel().eventLoop().schedule(() -> {
- log.error("六合服务端链接不上,开始重连操作...");
- try {
- tyTcpClientManager.initConnection(serverId,host, port);
- } catch (Exception e) {
- log.error("六合服务端连接异常: {}", e.getMessage());
- }
- }, 5, TimeUnit.SECONDS);
-
+ log.error("与边缘服务器服务{}:{}连接断开!", host, port);
+ TyTcpServerCache.putTcpServerCache(serverId, false);
super.channelInactive(ctx);
}
--
Gitblit v1.9.3