Make probetest wait for a datachannel to open

This commit is contained in:
Cecylia Bocovich 2020-11-05 16:48:00 -05:00
parent b5ce259858
commit 4663599382
2 changed files with 162 additions and 50 deletions

View file

@ -51,7 +51,12 @@ func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription,
return nil, fmt.Errorf("accept: NewPeerConnection: %s", err)
}
pc.OnDataChannel(func(dc *webrtc.DataChannel) {
close(dataChan)
dc.OnOpen(func() {
close(dataChan)
})
dc.OnClose(func() {
dc.Close()
})
})
err = pc.SetRemoteDescription(*sdp)