Skip to content

Commit

Permalink
remove unnecessary go routine
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Mar 14, 2024
1 parent a7d084f commit e33728d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions agent_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Check warning on line 52 in agent_handlers.go

View check run for this annotation

Codecov / codecov/patch

agent_handlers.go#L52

Added line #L52 was not covered by tests
}
}

Expand Down

0 comments on commit e33728d

Please sign in to comment.