mirror of
https://github.com/jech/galene.git
synced 2024-11-26 10:35:59 +01:00
Improve error handling during negotiation.
This commit is contained in:
parent
d5c7a13aae
commit
e3fd9a963a
1 changed files with 30 additions and 13 deletions
|
@ -620,8 +620,11 @@ ServerConnection.prototype.gotOffer = async function(id, labels, offer, renegoti
|
||||||
if(sc.ondownstream)
|
if(sc.ondownstream)
|
||||||
sc.ondownstream.call(sc, c);
|
sc.ondownstream.call(sc, c);
|
||||||
|
|
||||||
|
try {
|
||||||
await c.pc.setRemoteDescription(offer);
|
await c.pc.setRemoteDescription(offer);
|
||||||
await c.flushRemoteIceCandidates()
|
|
||||||
|
await c.flushRemoteIceCandidates();
|
||||||
|
|
||||||
let answer = await c.pc.createAnswer();
|
let answer = await c.pc.createAnswer();
|
||||||
if(!answer)
|
if(!answer)
|
||||||
throw new Error("Didn't create answer");
|
throw new Error("Didn't create answer");
|
||||||
|
@ -631,6 +634,16 @@ ServerConnection.prototype.gotOffer = async function(id, labels, offer, renegoti
|
||||||
id: id,
|
id: id,
|
||||||
answer: answer,
|
answer: answer,
|
||||||
});
|
});
|
||||||
|
} catch(e) {
|
||||||
|
try {
|
||||||
|
if(c.onerror)
|
||||||
|
c.onerror.call(c, e);
|
||||||
|
} finally {
|
||||||
|
c.abort();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
c.localDescriptionSent = true;
|
c.localDescriptionSent = true;
|
||||||
c.flushLocalIceCandidates();
|
c.flushLocalIceCandidates();
|
||||||
if(c.onnegotiationcompleted)
|
if(c.onnegotiationcompleted)
|
||||||
|
@ -667,8 +680,12 @@ ServerConnection.prototype.gotAnswer = async function(id, answer) {
|
||||||
try {
|
try {
|
||||||
await c.pc.setRemoteDescription(answer);
|
await c.pc.setRemoteDescription(answer);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
try {
|
||||||
if(c.onerror)
|
if(c.onerror)
|
||||||
c.onerror.call(c, e);
|
c.onerror.call(c, e);
|
||||||
|
} finally {
|
||||||
|
c.close();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await c.flushRemoteIceCandidates();
|
await c.flushRemoteIceCandidates();
|
||||||
|
|
Loading…
Reference in a new issue