Fix potential race condition
This commit is contained in:
parent
cec7c52505
commit
e433e7d470
|
@ -595,9 +595,9 @@ func (w *Waku) notifyPeersAboutTopicInterestChange(topicInterest []common.TopicT
|
|||
}
|
||||
|
||||
func (w *Waku) getPeers() []common.Peer {
|
||||
w.peerMu.Lock()
|
||||
arr := make([]common.Peer, len(w.peers))
|
||||
i := 0
|
||||
w.peerMu.Lock()
|
||||
for p := range w.peers {
|
||||
arr[i] = p
|
||||
i++
|
||||
|
|
|
@ -459,9 +459,9 @@ func (whisper *Whisper) notifyPeersAboutBloomFilterChange(bloom []byte) {
|
|||
}
|
||||
|
||||
func (whisper *Whisper) getPeers() []*Peer {
|
||||
whisper.peerMu.Lock()
|
||||
arr := make([]*Peer, len(whisper.peers))
|
||||
i := 0
|
||||
whisper.peerMu.Lock()
|
||||
for p := range whisper.peers {
|
||||
arr[i] = p
|
||||
i++
|
||||
|
|
Loading…
Reference in New Issue