|
@@ -1755,6 +1755,19 @@ ConnectionManager.prototype._setupIce = function() {
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
+ this.pc.oniceconnectionstatechange = function() {
|
|
|
+ if (!!self.pc && self.pc.iceConnectionState === 'disconnected') {
|
|
|
+ util.log('iceConnectionState is disconnected, closing connections to ' + this.peer);
|
|
|
+ self.close();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // Fallback for older Chrome impls.
|
|
|
+ this.pc.onicechange = function() {
|
|
|
+ if (!!self.pc && self.pc.iceConnectionState === 'disconnected') {
|
|
|
+ util.log('iceConnectionState is disconnected, closing connections to ' + this.peer);
|
|
|
+ self.close();
|
|
|
+ }
|
|
|
+ };
|
|
|
};
|
|
|
|
|
|
/** Set up onnegotiationneeded. */
|
|
@@ -1836,7 +1849,7 @@ ConnectionManager.prototype._makeAnswer = function() {
|
|
|
/** Clean up PC, close related DCs. */
|
|
|
ConnectionManager.prototype._cleanup = function() {
|
|
|
util.log('Cleanup ConnectionManager for ' + this.peer);
|
|
|
- if (!!this.pc && this.pc.readyState !== 'closed') {
|
|
|
+ if (!!this.pc && (this.pc.readyState !== 'closed' || this.pc.signalingState !== 'closed')) {
|
|
|
this.pc.close();
|
|
|
this.pc = null;
|
|
|
}
|