@@ -74,6 +74,7 @@ func (t *ICMPTracer) PrintFunc(ctx context.Context, cancel context.CancelCauseFu
7474 // 接收的时候检查一下是不是 3 跳都齐了
7575 if t .ttlComp (ttl + 1 ) {
7676 if t .RealtimePrinter != nil {
77+ t .res .waitGeo (ctx , ttl )
7778 t .RealtimePrinter (& t .res , ttl )
7879 }
7980 ttl ++
@@ -192,10 +193,7 @@ func (t *ICMPTracer) addHopWithIndex(peer net.Addr, ttl, i int, rtt time.Duratio
192193 RTT : rtt ,
193194 MPLS : mpls ,
194195 }
195-
196- _ = h .fetchIPData (t .Config ) // 忽略错误,继续添加结果
197-
198- t .res .add (h , i , t .NumMeasurements , t .MaxAttempts )
196+ t .res .addWithGeoAsync (h , i , t .NumMeasurements , t .MaxAttempts , t .Config )
199197}
200198
201199func (t * ICMPTracer ) matchWorker (ctx context.Context ) {
@@ -263,6 +261,7 @@ func (t *ICMPTracer) Execute() (res *Result, err error) {
263261 // 初始化 res.Hops 和 res.tailDone,并预分配到 MaxHops
264262 t .res .Hops = make ([][]Hop , t .MaxHops )
265263 t .res .tailDone = make ([]bool , t .MaxHops )
264+ t .res .setGeoWait (t .NumMeasurements )
266265
267266 // 解析并校验用户指定的 IPv4 源地址
268267 SrcAddr := net .ParseIP (t .SrcAddr ).To4 ()
@@ -436,7 +435,7 @@ func (t *ICMPTracer) send(ctx context.Context, s *internal.ICMPSpec, ttl, i int)
436435 Error : errHopLimitTimeout ,
437436 }
438437
439- t .res .add (h , i , t .NumMeasurements , t .MaxAttempts )
438+ _ , _ = t .res .add (h , i , t .NumMeasurements , t .MaxAttempts )
440439 t .dropSent (seq )
441440 }
442441 }(seq , ttl , i )
0 commit comments