reverseproxy: Pointer receiver

This avoids copying the Upstream, which has an atomically-accessed value
in it.
This commit is contained in:
Matthew Holt
2023-07-08 13:42:51 -06:00
parent 66114cb155
commit 5dec11f2a0

View File

@@ -63,9 +63,10 @@ type Upstream struct {
unhealthy int32 // accessed atomically; status from active health checker
}
func (u Upstream) String() string {
return u.Dial
}
// (pointer receiver necessary to avoid a race condition, since
// copying the Upstream reads the 'unhealthy' field which is
// accessed atomically)
func (u *Upstream) String() string { return u.Dial }
// Available returns true if the remote host
// is available to receive requests. This is