Skip to content

Commit

Permalink
event, whisper/whisperv6: use defer where possible (ethereum#20940)
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong authored Apr 28, 2020
1 parent 9887edd commit 0708b57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion whisper/whisperv6/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 0708b57

Please sign in to comment.