From 18a47035fea67d378e5935aa36a75b55edd3a02d Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 11 Aug 2025 02:28:59 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/main.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index eefc2f6..6a88b28 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -29,7 +29,7 @@ type ConcurrentResults struct { bgpResult string backtraceResult string bgpError error - backtraceError error + // backtraceError error } func main() { @@ -108,11 +108,17 @@ func main() { wg.Add(1) go func() { defer wg.Done() - result, err := bgptools.GetPoPInfo(targetIP) - if err == nil { - results.bgpResult = result.Result + for i := 0; i < 2; i++ { + result, err := bgptools.GetPoPInfo(targetIP) + results.bgpError = err + if err == nil && result.Result != "" { + results.bgpResult = result.Result + return + } + if i == 0 { + time.Sleep(3 * time.Second) + } } - results.bgpError = err }() } wg.Add(1)