Ver código fonte

fix race condition

ericz 12 anos atrás
pai
commit
317b490811
3 arquivos alterados com 8 adições e 4 exclusões
  1. 4 2
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 4 2
      lib/socket.js

+ 4 - 2
dist/peer.js

@@ -1421,8 +1421,10 @@ Socket.prototype._startWebSocket = function() {
   this._socket.onopen = function() {
     if (!!self._timeout) {
       clearTimeout(self._timeout);
-      self._http.abort();
-      self._http = null;
+      setTimeout(function(){
+        self._http.abort();
+        self._http = null;
+      }, 5000);
     }
     util.log('Socket open');
   };

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
dist/peer.min.js


+ 4 - 2
lib/socket.js

@@ -49,8 +49,10 @@ Socket.prototype._startWebSocket = function() {
   this._socket.onopen = function() {
     if (!!self._timeout) {
       clearTimeout(self._timeout);
-      self._http.abort();
-      self._http = null;
+      setTimeout(function(){
+        self._http.abort();
+        self._http = null;
+      }, 5000);
     }
     util.log('Socket open');
   };

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff