aboutsummaryrefslogtreecommitdiff
path: root/middleware/proxy/proxy.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/proxy/proxy.go')
-rw-r--r--middleware/proxy/proxy.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/middleware/proxy/proxy.go b/middleware/proxy/proxy.go
index ca7b8daa0..ce8b99d83 100644
--- a/middleware/proxy/proxy.go
+++ b/middleware/proxy/proxy.go
@@ -3,6 +3,7 @@ package proxy
import (
"errors"
+ "sync"
"sync/atomic"
"time"
@@ -56,9 +57,10 @@ type UpstreamHost struct {
Name string // IP address (and port) of this upstream host
Fails int32
FailTimeout time.Duration
- Unhealthy *bool
+ Unhealthy bool
CheckDown UpstreamHostDownFunc
WithoutPathPrefix string
+ checkMu sync.Mutex
}
// Down checks whether the upstream host is down or not.
@@ -68,7 +70,7 @@ func (uh *UpstreamHost) Down() bool {
if uh.CheckDown == nil {
// Default settings
fails := atomic.LoadInt32(&uh.Fails)
- return *uh.Unhealthy || fails > 0
+ return uh.Unhealthy || fails > 0
}
return uh.CheckDown(uh)
}