Skip to content

Commit 72e11d3

Browse files
committed
ipn/proxies,dnsx/transport: m log the chosen id among many
1 parent 010bfa5 commit 72e11d3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

intra/dnsx/transport.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ func (r *resolver) requiresGoosOrLocal(qname string) (id string) {
11101110
return
11111111
}
11121112

1113-
func (r *resolver) chooseOne(ids ...string) string {
1113+
func (r *resolver) chooseOne(ids ...string) (theone string) {
11141114
if len(ids) <= 0 {
11151115
return ""
11161116
}
@@ -1131,14 +1131,21 @@ func (r *resolver) chooseOne(ids ...string) string {
11311131
r.RUnlock()
11321132

11331133
best, preferred, recoverables, errored, ended := Categorize(trs)
1134+
if settings.Debug {
1135+
defer func() {
1136+
loged(len(theone) <= 0)("dns: pref: chose: %s from best(%v) prefer(%v) recov(%v) err(%v) dead(%v)",
1137+
theone, best, preferred, recoverables, errored, ended)
1138+
}()
1139+
}
1140+
11341141
if len(best) > 0 {
1135-
return best[0].ID().V()
1142+
return idstr(best[0])
11361143
} else if len(preferred) > 0 {
1137-
return preferred[0].ID().V()
1144+
return idstr(preferred[0])
11381145
} else if len(recoverables) > 0 {
1139-
return recoverables[0].ID().V()
1146+
return idstr(core.ChooseOne(recoverables))
11401147
} else if len(errored) > 0 {
1141-
return errored[0].ID().V()
1148+
return idstr(core.ChooseOne(errored))
11421149
}
11431150
log.E("dns: pref: no transports for %v [all ended? %v]", ids, ended)
11441151
return ""

intra/ipn/proxies.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ func (px *proxifier) removeProxy(id string, force bool) bool {
446446
// ProxyTo implements Proxies.
447447
// May return both a Proxy and an error, in which case, the error
448448
// denotes that while the Proxy is not healthy, it is still registered.
449-
func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ Proxy, err error) {
449+
func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (theone Proxy, err error) {
450450
ippstr := ipp.String()
451451
e := func(err error) error {
452452
return fmt.Errorf("%v for %s to %s among %v", err, uid, ippstr, pids)
@@ -525,8 +525,8 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
525525
}
526526

527527
defer func() {
528-
logev(err)("proxy: pin: %s+%s; stalled? %ds; local: %v; miss: %v; notok: %v; noroute: %v; paused %v; ended %v",
529-
uid, ipp, stalledSec, loproxies, missproxies, notokproxies, norouteproxies, pausedproxies, endproxies)
528+
logev(err)("proxy: pin: %s+%s; chosen? %s; stalled? %ds; local: %v; miss: %v; notok: %v; noroute: %v; paused %v; ended %v",
529+
uid, ipp, theone, stalledSec, loproxies, missproxies, notokproxies, norouteproxies, pausedproxies, endproxies)
530530
}()
531531

532532
for _, pid := range pids {

0 commit comments

Comments
 (0)