Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
swarm/network: protect addrCountC in Kademlia.AddrCountC function
Browse files Browse the repository at this point in the history
  • Loading branch information
janos committed Feb 11, 2019
1 parent 11d9441 commit e411147
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions swarm/network/kademlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ func (k *Kademlia) sendNeighbourhoodDepthChange() {
// Not receiving from the returned channel will block Register function
// when address count value changes.
func (k *Kademlia) AddrCountC() <-chan int {
k.lock.Lock()
defer k.lock.Unlock()

if k.addrCountC == nil {
k.addrCountC = make(chan int)
}
Expand Down

0 comments on commit e411147

Please sign in to comment.