Skip to content

Commit

Permalink
ipn/proxies: m join errs iff not ok
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Nov 22, 2024
1 parent bf602ac commit 5e1b951
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions intra/core/closer.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,15 @@ func JoinErr(errs ...error) error {
if len(errs) <= 0 {
return nil
}
if len(errs) == 1 {
return errs[0]
}
return fmt.Errorf("%v", errs)
}

func JoinErrIf(y bool, errs ...error) error {
if y {
return JoinErr(errs...)
}
return nil
}
6 changes: 4 additions & 2 deletions intra/ipn/proxies.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,11 @@ func (px *proxifier) pin(uid string, ipp netip.AddrPort, p Proxy) error {
px.uidPins.Put(uid, ipp, p.ID())
px.ipPins.Put(ipp, p.ID())
}
ok := err == nil
logev(err)("proxy: pin: ok? %t; %s from %s; err? %v",
err == nil, ipp, p.ID(), err)
return core.JoinErr(err, errCannotPin)
ok, ipp, p.ID(), err)

return core.JoinErrIf(!ok, err, errCannotPin)
}

func (px *proxifier) delpin(uid string, ipp netip.AddrPort) {
Expand Down

0 comments on commit 5e1b951

Please sign in to comment.