mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 07:56:37 +08:00
修复bug
This commit is contained in:
@@ -272,19 +272,6 @@ public class WebSocketServer extends TextWebSocketHandler {
|
||||
|
||||
|
||||
public static GostDto send_msg(Long node_id, Object msg, String type) {
|
||||
return send_msg(node_id, msg, type, 10); // 默认10秒超时
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息到指定节点(支持自定义超时时间)
|
||||
*
|
||||
* @param node_id 节点ID
|
||||
* @param msg 消息内容
|
||||
* @param type 消息类型
|
||||
* @param timeoutSeconds 超时时间(秒)
|
||||
* @return 响应结果
|
||||
*/
|
||||
public static GostDto send_msg(Long node_id, Object msg, String type, int timeoutSeconds) {
|
||||
WebSocketSession nodeSession = nodeSessions.get(node_id);
|
||||
|
||||
if (nodeSession == null) {
|
||||
@@ -314,7 +301,7 @@ public class WebSocketServer extends TextWebSocketHandler {
|
||||
data.put("data", msg);
|
||||
data.put("requestId", requestId);
|
||||
sendToUser(nodeSession, data.toJSONString());
|
||||
GostDto result = future.get(timeoutSeconds, TimeUnit.SECONDS);
|
||||
GostDto result = future.get(10, TimeUnit.SECONDS);
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -91,13 +91,13 @@ public class FlowController extends BaseController {
|
||||
if (!Objects.equals(userTunnelId, DEFAULT_USER_TUNNEL_ID)) {
|
||||
userTunnel = userTunnelService.getById(userTunnelId);
|
||||
}
|
||||
|
||||
System.out.println(flowDataList);
|
||||
// 4. 处理流量倍率
|
||||
List<FlowDto> validFlowData = flowDataList;
|
||||
if (forward != null) {
|
||||
validFlowData = filterFlowData(flowDataList, forward.getTunnelId());
|
||||
}
|
||||
|
||||
System.out.println(validFlowData);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -853,29 +853,18 @@ public class TunnelServiceImpl extends ServiceImpl<TunnelMapper, Tunnel> impleme
|
||||
nodeService.updateById(node);
|
||||
|
||||
result.setSuccess(false);
|
||||
result.setMessage(String.format("节点 %s 实际已离线(WebSocket连接断开),已更新节点状态。请重新启动节点或检查网络连接", node.getName()));
|
||||
result.setMessage("节点WebSocket连接已断开,请检查节点是否正常运行");
|
||||
result.setAverageTime(-1.0);
|
||||
result.setPacketLoss(100.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 如果连接正常,执行标准的ping诊断
|
||||
DiagnosisResult pingResult = performPingDiagnosis(node, targetIp, description);
|
||||
|
||||
// 如果ping失败,添加更详细的错误信息
|
||||
if (!pingResult.isSuccess() && pingResult.getMessage() != null) {
|
||||
if (pingResult.getMessage().contains("等待响应超时")) {
|
||||
pingResult.setMessage(String.format("节点 %s 响应超时,可能网络延迟较高或负载过重", node.getName()));
|
||||
} else if (pingResult.getMessage().contains("节点无响应")) {
|
||||
pingResult.setMessage(String.format("节点 %s 无响应,请检查节点状态", node.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
return pingResult;
|
||||
return performPingDiagnosis(node, targetIp, description);
|
||||
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(String.format("诊断节点 %s 时发生异常: %s", node.getName(), e.getMessage()));
|
||||
result.setMessage("连接检查异常: " + e.getMessage());
|
||||
result.setAverageTime(-1.0);
|
||||
result.setPacketLoss(100.0);
|
||||
return result;
|
||||
@@ -895,7 +884,7 @@ public class TunnelServiceImpl extends ServiceImpl<TunnelMapper, Tunnel> impleme
|
||||
testData.put("ip", "127.0.0.1");
|
||||
testData.put("count", 1);
|
||||
|
||||
GostDto testResult = WebSocketServer.send_msg(nodeId, testData, "Ping", 3);
|
||||
GostDto testResult = WebSocketServer.send_msg(nodeId, testData, "Ping");
|
||||
|
||||
// 如果能收到任何响应(不管是成功还是失败),说明WebSocket连接正常
|
||||
return testResult != null &&
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
:loading="node.copyLoading"
|
||||
plain
|
||||
>
|
||||
复制命令
|
||||
复制
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
|
||||
Reference in New Issue
Block a user