diff --git a/agent_handlers.go b/agent_handlers.go index 2509a42d..a1e87598 100644 --- a/agent_handlers.go +++ b/agent_handlers.go @@ -3,8 +3,6 @@ package ice -import "sync" - // OnConnectionStateChange sets a handler that is fired when the connection state changes func (a *Agent) OnConnectionStateChange(f func(ConnectionState)) error { a.onConnectionStateChangeHdlr.Store(f) @@ -50,14 +48,8 @@ func (a *Agent) candidatePairRoutine() { } func (a *Agent) connectionStateRoutine() { - var wg sync.WaitGroup for s := range a.chanState { - wg.Add(1) - go func() { - a.onConnectionStateChange(s) - wg.Done() - }() - wg.Wait() + a.onConnectionStateChange(s) } }