Skip to content

Commit

Permalink
remove unnecessary goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Mar 14, 2024
1 parent 14fad45 commit 98dca89
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,7 @@ func (pc *PeerConnection) onConnectionStateChange(cs PeerConnectionState) {
pc.connectionState.Store(cs)
pc.log.Infof("peer connection state changed: %s", cs)
if handler, ok := pc.onConnectionStateChangeHandler.Load().(func(PeerConnectionState)); ok && handler != nil {
var wg sync.WaitGroup
wg.Add(1)
go func() {
handler(cs)
wg.Done()
}()
wg.Wait()
handler(cs)
}
}

Expand Down

0 comments on commit 98dca89

Please sign in to comment.