Skip to content

Commit

Permalink
swarm: send notifications synchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed May 26, 2022
1 parent f3195e9 commit 97d3183
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions p2p/net/swarm/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,18 +541,10 @@ func (s *Swarm) Backoff() *DialBackoff {

// notifyAll sends a signal to all Notifiees
func (s *Swarm) notifyAll(notify func(network.Notifiee)) {
var wg sync.WaitGroup

s.notifs.RLock()
wg.Add(len(s.notifs.m))
for f := range s.notifs.m {
go func(f network.Notifiee) {
defer wg.Done()
notify(f)
}(f)
notify(f)
}

wg.Wait()
s.notifs.RUnlock()
}

Expand Down

0 comments on commit 97d3183

Please sign in to comment.