aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpusoft <cpusoft@live.com>2018-04-11 16:02:33 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-04-11 16:02:33 +0800
commite7cc5b41605f9145b2cb5755476456f30974a2c8 (patch)
tree24ee2518ed9935afeb3451680ab0f2dc0e7e3695
parent34ecb495b673b9ce35af20ccb5b44cd175003b94 (diff)
downloadgo-tangerine-e7cc5b41605f9145b2cb5755476456f30974a2c8.tar.gz
go-tangerine-e7cc5b41605f9145b2cb5755476456f30974a2c8.tar.zst
go-tangerine-e7cc5b41605f9145b2cb5755476456f30974a2c8.zip
les: add ps.lock.Unlock() before return (#16360)
-rw-r--r--les/peer.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/les/peer.go b/les/peer.go
index caf568077..eb7452e27 100644
--- a/les/peer.go
+++ b/les/peer.go
@@ -545,9 +545,11 @@ func (ps *peerSet) notify(n peerSetNotify) {
func (ps *peerSet) Register(p *peer) error {
ps.lock.Lock()
if ps.closed {
+ ps.lock.Unlock()
return errClosed
}
if _, ok := ps.peers[p.id]; ok {
+ ps.lock.Unlock()
return errAlreadyRegistered
}
ps.peers[p.id] = p