From 920efa68f0b3a5170dc0f5738638494f8540a2c0 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Thu, 9 Dec 2021 08:41:39 +0400 Subject: [PATCH] send notifications synchronously --- swarm.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/swarm.go b/swarm.go index e5077ac0..e297ec23 100644 --- a/swarm.go +++ b/swarm.go @@ -506,18 +506,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() }