middleware/proxy: fix race; add Go 1.7 backward compatibility (#603)

* Fix race on backend health status update
* Ensure test case is compatible on Go 1.7
This commit is contained in:
Michael S. Fischer
2017-03-17 00:20:55 -07:00
committed by Miek Gieben
parent dfc71df07d
commit 7dc431ada3
3 changed files with 13 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ package proxy
import (
"errors"
"sync"
"sync/atomic"
"time"
@@ -59,6 +60,7 @@ type UpstreamHost struct {
Unhealthy bool
CheckDown UpstreamHostDownFunc
WithoutPathPrefix string
checkMu sync.Mutex
}
// Down checks whether the upstream host is down or not.