Przeglądaj źródła

fix race condition

ericz 12 lat temu
rodzic
commit
317b490811
3 zmienionych plików z 8 dodań i 4 usunięć
  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');
   };

Plik diff jest za duży
+ 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');
   };

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików