commit e8c41650ae44e300aabe57e361c445808635fb4f Author: David Fifield david@bamsoftware.com Date: Fri Apr 24 11:44:40 2020 -0600
Move establishDataChannel to after exchangeSDP. --- client/lib/webrtc.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go index 7ceeaff..b4c0aad 100644 --- a/client/lib/webrtc.go +++ b/client/lib/webrtc.go @@ -120,11 +120,6 @@ func (c *WebRTCPeer) connect(config *webrtc.Configuration, broker *BrokerChannel if err != nil { return err } - err = c.establishDataChannel() - if err != nil { - // nolint: golint - return errors.New("WebRTC: Could not establish DataChannel") - } answer := exchangeSDP(broker, c.pc.LocalDescription()) log.Printf("Received Answer.\n") err = c.pc.SetRemoteDescription(*answer) @@ -132,6 +127,11 @@ func (c *WebRTCPeer) connect(config *webrtc.Configuration, broker *BrokerChannel log.Println("WebRTC: Unable to SetRemoteDescription:", err) return err } + err = c.establishDataChannel() + if err != nil { + // nolint: golint + return errors.New("WebRTC: Could not establish DataChannel") + } go c.checkForStaleness() return nil }