fix: restore the original fallback concurrency behavior

This commit is contained in:
wwqgtxx committed 2026-06-21 13:33:42 +08:00
1 parent e64f58f333
commit 42810015f9
1 file changed
+3 -2
+3 -2
View File
@@ -310,12 +310,13 @@ func (r *Resolver) ipExchange(ctx context.Context, m *D.Msg) (msg *D.Msg, err er
msgCh := r.asyncExchange(ctx, r.main, m)
if r.fallback == nil || len(r.fallback) == 0 { // directly return if no fallback servers are available
if r.fallback == nil { // directly return if no fallback servers are available
res := <-msgCh
msg, err = res.Msg, res.Error
return
}
fallbackMsg := r.asyncExchange(ctx, r.fallback, m)
res := <-msgCh
if res.Error == nil {
if ips := msgToIP(res.Msg); len(ips) != 0 {
@@ -329,7 +330,7 @@ func (r *Resolver) ipExchange(ctx context.Context, m *D.Msg) (msg *D.Msg, err er
}
}
res = <-r.asyncExchange(ctx, r.fallback, m)
res = <-fallbackMsg
msg, err = res.Msg, res.Error
return
}