Skip to content

Commit

Permalink
fix lock pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed Oct 6, 2023
1 parent 2602097 commit 63f4e11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions share/p2p/peers/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ func (p *pool) len() int {

// reset will reset the pool to its initial state.
func (p *pool) reset() {
p.m.Lock()
defer p.m.Unlock()
lock := &p.m
lock.Lock()
defer lock.Lock()
// swap the pool with an empty one
*p = *newPool(time.Second)
}

0 comments on commit 63f4e11

Please sign in to comment.