Explorar o código

fix race condition

ericz %!s(int64=12) %!d(string=hai) anos
pai
achega
317b490811
Modificáronse 3 ficheiros con 8 adicións e 4 borrados
  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');
   };

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 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');
   };

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