From e732bda3fa076707e2837eb9edfe8955ee8f4ad8 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 1 Jun 2022 18:41:54 +0200 Subject: [PATCH] swarm: send notifications synchronously (#1562) --- p2p/net/swarm/swarm.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/p2p/net/swarm/swarm.go b/p2p/net/swarm/swarm.go index 9df1840370..e14a068c77 100644 --- a/p2p/net/swarm/swarm.go +++ b/p2p/net/swarm/swarm.go @@ -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() }