les: add ps.lock.Unlock() before return (#16360)
This commit is contained in:
parent
34ecb495b6
commit
e7cc5b4160
@ -545,9 +545,11 @@ func (ps *peerSet) notify(n peerSetNotify) {
|
|||||||
func (ps *peerSet) Register(p *peer) error {
|
func (ps *peerSet) Register(p *peer) error {
|
||||||
ps.lock.Lock()
|
ps.lock.Lock()
|
||||||
if ps.closed {
|
if ps.closed {
|
||||||
|
ps.lock.Unlock()
|
||||||
return errClosed
|
return errClosed
|
||||||
}
|
}
|
||||||
if _, ok := ps.peers[p.id]; ok {
|
if _, ok := ps.peers[p.id]; ok {
|
||||||
|
ps.lock.Unlock()
|
||||||
return errAlreadyRegistered
|
return errAlreadyRegistered
|
||||||
}
|
}
|
||||||
ps.peers[p.id] = p
|
ps.peers[p.id] = p
|
||||||
|
Loading…
Reference in New Issue
Block a user