Michelle Bu %!s(int64=11) %!d(string=hai) anos
pai
achega
f15526bbfb
Modificáronse 3 ficheiros con 12 adicións e 11 borrados
  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.

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 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.

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio