Skip to content

Commit

Permalink
add ps.lock.Unlock() before return
Browse files Browse the repository at this point in the history
  • Loading branch information
cpusoft authored Mar 22, 2018
1 parent 933972d commit 2e436fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions les/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,11 @@ func (ps *peerSet) notify(n peerSetNotify) {
func (ps *peerSet) Register(p *peer) error {
ps.lock.Lock()
if ps.closed {
ps.lock.Unlock()
return errClosed
}
if _, ok := ps.peers[p.id]; ok {
ps.lock.Unlock()
return errAlreadyRegistered
}
ps.peers[p.id] = p
Expand Down

0 comments on commit 2e436fb

Please sign in to comment.