Skip to content

Commit 010bfa5

Browse files
committed
ipn/proxies: skip pinned proxy iff it's pin status OK
1 parent 4d457a0 commit 010bfa5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

intra/ipn/proxies.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,12 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
490490
chosen := has(pids, pinnedpid)
491491
lo := local(pinnedpid)
492492

493-
log.VV("proxy: pin: %s+%s; pinned: %s; chosen? %t / local? %t; from pids: %v",
494-
uid, ippstr, pinnedpid, chosen, lo, pids)
493+
log.VV("proxy: pin: %s+%s; pinned: %s (ok? %t); chosen? %t / local? %t; from pids: %v",
494+
uid, ippstr, pinnedpid, pinok, chosen, lo, pids)
495+
496+
if !pinok { // discard pinnedpid if pin has expired
497+
pinnedpid = ""
498+
}
495499

496500
if pinok && chosen && lo {
497501
// always favour remote proxy pins over local, if any
@@ -504,6 +508,8 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
504508
}
505509
px.delpin(uid, ipp) // del pin if no route
506510
} // else: pinnedpid not ok (ex: END/TPU) or no route
511+
log.W("proxy: pin: %s+%s; chosen and pinned: %s (but err? %v); hasproxy? %t (or no route)",
512+
uid, ippstr, pinnedpid, err, p != nil)
507513
} else if pinok && !chosen {
508514
px.delpin(uid, ipp)
509515
}
@@ -524,7 +530,7 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
524530
}()
525531

526532
for _, pid := range pids {
527-
if pid == pinnedpid { // already tried above
533+
if pinok && pid == pinnedpid { // already tried above
528534
continue
529535
}
530536
if local(pid) { // skip local; prefer remote

0 commit comments

Comments
 (0)