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 0b043b5
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions p2p/net/swarm/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,19 +541,9 @@ 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()
}

// Notify signs up Notifiee to receive signals when events happen
Expand Down

0 comments on commit 0b043b5

Please sign in to comment.