aboutsummaryrefslogtreecommitdiffstats
path: root/les/helper_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'les/helper_test.go')
-rw-r--r--les/helper_test.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/les/helper_test.go b/les/helper_test.go
index 2df3faab2..0d1aba9a5 100644
--- a/les/helper_test.go
+++ b/les/helper_test.go
@@ -336,10 +336,23 @@ func (p *testPeer) close() {
p.app.Close()
}
-type testServerPool peer
+type testServerPool struct {
+ peer *peer
+ lock sync.RWMutex
+}
+
+func (p *testServerPool) setPeer(peer *peer) {
+ p.lock.Lock()
+ defer p.lock.Unlock()
+
+ p.peer = peer
+}
+
+func (p *testServerPool) selectPeerWait(uint64, func(*peer) (bool, time.Duration), <-chan struct{}) *peer {
+ p.lock.RLock()
+ defer p.lock.RUnlock()
-func (p *testServerPool) selectPeer(func(*peer) (bool, uint64)) *peer {
- return (*peer)(p)
+ return p.peer
}
func (p *testServerPool) adjustResponseTime(*poolEntry, time.Duration, bool) {