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
1 changed files with 1 additions and 1 deletions

View File

@ -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)