mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-06 01:56:37 +08:00
会滚
This commit is contained in:
@@ -324,19 +324,7 @@ public class WebSocketServer extends TextWebSocketHandler {
|
|||||||
|
|
||||||
log.info("节点 {} 当前活跃连接关闭,开始验证并更新状态", nodeId);
|
log.info("节点 {} 当前活跃连接关闭,开始验证并更新状态", nodeId);
|
||||||
|
|
||||||
// 先验证连接是否真的断开(发送call消息测试)
|
// 移除会话映射
|
||||||
boolean shouldUpdateOffline = true;
|
|
||||||
try {
|
|
||||||
// 尝试发送验证消息,如果发送成功说明连接可能还活跃
|
|
||||||
sendToUser(session, "{\"type\":\"call\"}", null);
|
|
||||||
log.warn("节点 {} 连接关闭但仍能发送消息,可能是假断开", nodeId);
|
|
||||||
shouldUpdateOffline = false;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.info("节点 {} 连接验证失败,确认连接已断开: {}", nodeId, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldUpdateOffline) {
|
|
||||||
// 移除会话映射
|
|
||||||
WebSocketSession removedSession = nodeSessions.remove(nodeId);
|
WebSocketSession removedSession = nodeSessions.remove(nodeId);
|
||||||
|
|
||||||
// 更新节点状态为离线
|
// 更新节点状态为离线
|
||||||
@@ -359,7 +347,6 @@ public class WebSocketServer extends TextWebSocketHandler {
|
|||||||
} else {
|
} else {
|
||||||
log.warn("节点 {} 不存在,无法更新离线状态", nodeId);
|
log.warn("节点 {} 不存在,无法更新离线状态", nodeId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理session锁对象
|
// 清理session锁对象
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ public class ForwardController extends BaseController {
|
|||||||
* @return 诊断结果
|
* @return 诊断结果
|
||||||
*/
|
*/
|
||||||
@LogAnnotation
|
@LogAnnotation
|
||||||
@RequireRole
|
|
||||||
@PostMapping("/diagnose")
|
@PostMapping("/diagnose")
|
||||||
public R diagnoseForward(@RequestBody Map<String, Object> params) {
|
public R diagnoseForward(@RequestBody Map<String, Object> params) {
|
||||||
Long forwardId = Long.valueOf(params.get("forwardId").toString());
|
Long forwardId = Long.valueOf(params.get("forwardId").toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user