Fix bug where clients try to re-answer established connections.

This commit is contained in:
JBYoshi 2019-02-11 18:54:44 -06:00
parent a251483e97
commit 0b743fa091
No known key found for this signature in database
GPG key ID: 468C80811BCC9A6A

View file

@ -273,8 +273,14 @@ class RTCPeer extends Peer {
if (message.sdp) {
this._conn.setRemoteDescription(new RTCSessionDescription(message.sdp))
.then( _ => this._conn.createAnswer())
.then(d => this._onDescription(d))
.then( _ => {
if (message.sdp.type == 'offer') {
return this._conn.createAnswer()
.then(d => this._onDescription(d));
} else {
return null;
}
})
.catch(e => this._onError(e));
} else if (message.ice) {
this._conn.addIceCandidate(new RTCIceCandidate(message.ice));