From f76fec1fd97e0a9cde47c1051f32745f8b1d13ad Mon Sep 17 00:00:00 2001 From: Pger-Y Date: Thu, 21 Nov 2019 21:15:58 +0800 Subject: [PATCH] cluster: change lock from Read lock to Write Lock since function modifies the struct... (#2109) Signed-off-by: John Smith --- cluster/cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster/cluster.go b/cluster/cluster.go index 57d82bdc..322481ea 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -260,8 +260,8 @@ func (p *Peer) setInitialFailed(peers []string, myAddr string) { return } - p.peerLock.RLock() - defer p.peerLock.RUnlock() + p.peerLock.Lock() + defer p.peerLock.Unlock() now := time.Now() for _, peerAddr := range peers {