Skip to content

Commit

Permalink
unlock on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Apr 24, 2023
1 parent 1508a4a commit ae39f79
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions share/availability/discovery/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (ps *limitedSet) Size() int {
func (ps *limitedSet) Add(p peer.ID) error {
ps.lk.Lock()
if _, ok := ps.ps[p]; ok {
ps.lk.Unlock()
return errors.New("share: discovery: peer already added")
}
ps.ps[p] = struct{}{}
Expand Down

0 comments on commit ae39f79

Please sign in to comment.