eth/downloader: don't use defer for unlock before return (#21227)

Co-authored-by: linjing <linjingjing@baidu.com>
This commit is contained in:
sixdays 2020-06-15 20:46:27 +08:00 committed by GitHub
parent 9371b2f70c
commit a981b60c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -421,7 +421,7 @@ func (ps *peerSet) Unregister(id string) error {
ps.lock.Lock()
p, ok := ps.peers[id]
if !ok {
defer ps.lock.Unlock()
ps.lock.Unlock()
return errNotRegistered
}
delete(ps.peers, id)