fix: 修复upf5002 telnet消息返回延迟导致命令行为不一致

This commit is contained in:
TsMask
2025-06-11 19:28:19 +08:00
parent a485d4eb9a
commit 72757e4ea8
2 changed files with 6 additions and 5 deletions

View File

@@ -230,6 +230,7 @@ func (s *TCPdump) UPFTrace(neType, neId, cmdStr string) (string, error) {
return "", err
}
defer telnetClient.Close()
telnetClient.RunCMD("") // 再次排空信息
// 命令拼装
fileName := fmt.Sprintf("%s_%s_part_%s.pcap ", neInfo.NeType, neInfo.NeId, time.Now().Format("20060102150405"))
@@ -250,11 +251,11 @@ func (s *TCPdump) UPFTrace(neType, neId, cmdStr string) (string, error) {
// 结果截取
arr := strings.Split(output, "\r\n")
if len(arr) == 2 {
if len(arr) < 2 {
return "", fmt.Errorf("trace pacp run failed")
}
if len(arr) > 3 {
resMsg := arr[2]
if len(arr) == 3 {
resMsg := arr[1]
// pcap trace: unknown input `f file UPF_001_part_2024-08-19...'
// pcap trace: dispatch trace already enabled...
// pcap trace: dispatch trace already disabled...