mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
reverseproxy: Pointer receiver
This avoids copying the Upstream, which has an atomically-accessed value in it.
This commit is contained in:
parent
66114cb155
commit
5dec11f2a0
1 changed files with 4 additions and 3 deletions
|
@ -63,9 +63,10 @@ type Upstream struct {
|
||||||
unhealthy int32 // accessed atomically; status from active health checker
|
unhealthy int32 // accessed atomically; status from active health checker
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u Upstream) String() string {
|
// (pointer receiver necessary to avoid a race condition, since
|
||||||
return u.Dial
|
// 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
|
// Available returns true if the remote host
|
||||||
// is available to receive requests. This is
|
// is available to receive requests. This is
|
||||||
|
|
Loading…
Reference in a new issue