瀏覽代碼

fix race condition

ericz 12 年之前
父節點
當前提交
317b490811
共有 3 個文件被更改,包括 8 次插入4 次删除
  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');
   };

文件差異過大導致無法顯示
+ 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');
   };

部分文件因文件數量過多而無法顯示