mirror of
https://github.com/status-im/status-go.git
synced 2025-01-31 00:48:01 +00:00
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…
x
Reference in New Issue
Block a user