event, whisper/whisperv6: use defer where possible (#20940)

release/1.9
ucwong 5 years ago committed by GitHub
parent 9887edd580
commit 0708b573bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      event/event.go
  2. 2
      whisper/whisperv6/whisper.go

@ -196,9 +196,9 @@ func (s *TypeMuxSubscription) closewait() {
s.closed = true
s.postMu.Lock()
defer s.postMu.Unlock()
close(s.postC)
s.postC = nil
s.postMu.Unlock()
}
func (s *TypeMuxSubscription) deliver(event *TypeMuxEvent) {

@ -340,11 +340,11 @@ func (whisper *Whisper) getPeers() []*Peer {
arr := make([]*Peer, len(whisper.peers))
i := 0
whisper.peerMu.Lock()
defer whisper.peerMu.Unlock()
for p := range whisper.peers {
arr[i] = p
i++
}
whisper.peerMu.Unlock()
return arr
}

Loading…
Cancel
Save