Explicitly close the Engine Connection when ICE fails (#732)

This will avoid letting the stack think its ready until it times out,
and will hopefully help with faster retry logic in the future

Signed-off-by: Paul Tagliamonte <paul@kittycad.io>
This commit is contained in:
Paul Tagliamonte
2023-10-02 09:50:49 -04:00
committed by GitHub
parent 7352de5a70
commit 9e02bab155

View File

@ -360,6 +360,11 @@ export class EngineConnection {
if (this.shouldTrace()) {
iceSpan.resolve?.()
}
} else if (this.pc?.iceConnectionState === 'failed') {
// failed is a terminal state; let's explicitly kill the
// connection to the server at this point.
console.log('failed to negotiate ice connection; restarting')
this.close()
}
})