eth/downloader: don't use defer for unlock before return (#21227)
Co-authored-by: linjing <linjingjing@baidu.com>
This commit is contained in:
parent
9371b2f70c
commit
a981b60c25
|
@ -421,7 +421,7 @@ func (ps *peerSet) Unregister(id string) error {
|
||||||
ps.lock.Lock()
|
ps.lock.Lock()
|
||||||
p, ok := ps.peers[id]
|
p, ok := ps.peers[id]
|
||||||
if !ok {
|
if !ok {
|
||||||
defer ps.lock.Unlock()
|
ps.lock.Unlock()
|
||||||
return errNotRegistered
|
return errNotRegistered
|
||||||
}
|
}
|
||||||
delete(ps.peers, id)
|
delete(ps.peers, id)
|
||||||
|
|
Loading…
Reference in New Issue