Skip to content

Commit

Permalink
swarm: send notifications synchronously (#1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored and MarcoPolo committed Jun 24, 2022
1 parent c4ef41f commit d4e0b6a
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 d4e0b6a

Please sign in to comment.