Michelle Bu 11 rokov pred
rodič
commit
f15526bbfb
3 zmenil súbory, kde vykonal 12 pridanie a 11 odobranie
  1. 6 5
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 6 6
      lib/dataconnection.js

+ 6 - 5
dist/peer.js

@@ -1689,13 +1689,14 @@ DataConnection.prototype._configureDataChannel = function() {
 }
 
 DataConnection.prototype._cleanup = function() {
-  if (this._dc && this._dc.readyState !== 'closed') {
+  if (this._dc.readyState !== 'closing' && this._dc.readyState !== 'closed') {
     this._dc.close();
-    this._dc = null;
+    this.open = false;
+    Negotiator.cleanup(this);
+    this.emit('close');
+  } else {
+    this.emit('error', new Error('The connection has already been closed'));
   }
-  this.open = false;
-  Negotiator.cleanup(this);
-  this.emit('close');
 }
 
 // Handles a DataChannel message.

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/peer.min.js


+ 6 - 6
lib/dataconnection.js

@@ -81,14 +81,14 @@ DataConnection.prototype._configureDataChannel = function() {
 }
 
 DataConnection.prototype._cleanup = function() {
-  if (this._dc && this._dc.readyState !== 'closed') {
-    console.log('closing', this._dc);
+  if (this._dc.readyState !== 'closing' && this._dc.readyState !== 'closed') {
     this._dc.close();
-    this._dc = null;
+    this.open = false;
+    Negotiator.cleanup(this);
+    this.emit('close');
+  } else {
+    this.emit('error', new Error('The connection has already been closed'));
   }
-  this.open = false;
-  Negotiator.cleanup(this);
-  this.emit('close');
 }
 
 // Handles a DataChannel message.

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov