瀏覽代碼

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

Co-authored-by: linjing <linjingjing@baidu.com>
sixdays 5 年之前
父節點
當前提交
a981b60c25
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      eth/downloader/peer.go

+ 1 - 1
eth/downloader/peer.go

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