mirror of
https://github.com/pion/webrtc.git
synced 2024-05-03 11:54:53 +08:00
make ice connection callback synchronous
This commit is contained in:
parent
0b447fd06d
commit
46bc73031d
@ -497,7 +497,12 @@ 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 {
|
||||
go handler(cs)
|
||||
ch := make(chan struct{})
|
||||
go func() {
|
||||
handler(cs)
|
||||
close(ch)
|
||||
}()
|
||||
<-ch
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user