summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/hosts.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/reverseproxy/hosts.go')
-rw-r--r--modules/caddyhttp/reverseproxy/hosts.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/caddyhttp/reverseproxy/hosts.go b/modules/caddyhttp/reverseproxy/hosts.go
index 298d4f3..83a39d8 100644
--- a/modules/caddyhttp/reverseproxy/hosts.go
+++ b/modules/caddyhttp/reverseproxy/hosts.go
@@ -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