Skip to content

Commit eeb5149

Browse files
committed
ipn/proxies: ProxyTo case where the only proxy is paused
1 parent 53437ed commit eeb5149

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

intra/ipn/proxies.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,12 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
468468
}
469469
logev(err)("proxy: pin: %s+%s; pin pid0: %s (stalled? %ds); err? %v",
470470
uid, ippstr, pids[0], stalledSec, err)
471+
st := p.Status()
472+
if st == END {
473+
return nil, core.OneErr(err, errProxyStopped)
474+
} else if st == TPU {
475+
return nil, core.OneErr(err, errProxyPaused)
476+
}
471477
// alwaysPin is set to true, so wipe out err; return p, even if err is not nil
472478
if alwaysPin && p != nil {
473479
return p, nil
@@ -492,7 +498,7 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
492498
p, err := px.pinID(uid, ipp, pinnedpid) // repin
493499
if p != nil && err == nil && hasroute(p, ippstr) {
494500
return p, nil
495-
} // else: pinnedpid not ok or no route
501+
} // else: pinnedpid not ok (ex: END/TPU) or no route
496502
} else if pinok && !chosen {
497503
px.delpin(uid, ipp)
498504
}
@@ -578,6 +584,15 @@ func (px *proxifier) ProxyTo(ipp netip.AddrPort, uid string, pids []string) (_ P
578584
}
579585

580586
stalledSec = px.stall(uid + ippstr)
587+
588+
if len(missproxies) <= 0 &&
589+
len(norouteproxies) <= 0 &&
590+
len(endproxies) <= 0 &&
591+
len(notokproxies) <= 0 &&
592+
len(pausedproxies) > 0 {
593+
return nil, errProxyPaused
594+
}
595+
581596
return nil, errProxyAllDown
582597
}
583598

0 commit comments

Comments
 (0)