mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Use OnIceGatheringStateChange instead of OnIceComplete in client
Amounts to the same thing as currently implemented in go-webrtc
This commit is contained in:
parent
d7676d2b9e
commit
5380aaca8c
1 changed files with 6 additions and 5 deletions
|
@ -176,14 +176,15 @@ func (c *WebRTCPeer) preparePeerConnection() error {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
// Allow candidates to accumulate until OnIceComplete.
|
// Allow candidates to accumulate until IceGatheringStateComplete.
|
||||||
pc.OnIceCandidate = func(candidate webrtc.IceCandidate) {
|
pc.OnIceCandidate = func(candidate webrtc.IceCandidate) {
|
||||||
log.Printf(candidate.Candidate)
|
log.Printf(candidate.Candidate)
|
||||||
}
|
}
|
||||||
// TODO: This may soon be deprecated, consider OnIceGatheringStateChange.
|
pc.OnIceGatheringStateChange = func(state webrtc.IceGatheringState) {
|
||||||
pc.OnIceComplete = func() {
|
if state == webrtc.IceGatheringStateComplete {
|
||||||
log.Printf("WebRTC: OnIceComplete")
|
log.Printf("WebRTC: IceGatheringStateComplete")
|
||||||
c.offerChannel <- pc.LocalDescription()
|
c.offerChannel <- pc.LocalDescription()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// This callback is not expected, as the Client initiates the creation
|
// This callback is not expected, as the Client initiates the creation
|
||||||
// of the data channel, not the remote peer.
|
// of the data channel, not the remote peer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue