Forráskód Böngészése

#24: multiple DCs are not configurable on FF due to no answer/offer exchange. a settimeout is probably not worth it

Michelle Bu 12 éve
szülő
commit
c2852bf789
3 módosított fájl, 10 hozzáadás és 11 törlés
  1. 4 5
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 6 6
      lib/connectionmanager.js

+ 4 - 5
dist/peer.js

@@ -1884,9 +1884,7 @@ ConnectionManager.prototype._attachConnectionListeners = function(connection) {
   });
   connection.on('open', function() {
     self._lock = false;
-    if (util.browserisms !== 'Firefox') {
-      self._processQueue();
-    }
+    self._processQueue();
   });
 };
 
@@ -1985,14 +1983,15 @@ ConnectionManager.prototype.connect = function(options) {
   this.labels[options.label] = options;
 
   var dc;
-  if (!!this.pc && !this._lock && util.browserisms !== 'Firefox') {
+  if (!!this.pc && !this._lock && (util.browserisms !== 'Firefox' || Object.keys(this.connections).length !== 0)) {
     dc = this.pc.createDataChannel(options.label, { reliable: false });
+    dc._options = options;
   }
   var connection = new DataConnection(this.peer, dc, options);
   this._attachConnectionListeners(connection);
   this.connections[options.label] = connection;
 
-  if (!this.pc || this._lock || util.browserisms === 'Firefox') {
+  if (!dc) {
     this._queued.push(connection);
   }
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
dist/peer.min.js


+ 6 - 6
lib/connectionmanager.js

@@ -172,7 +172,9 @@ ConnectionManager.prototype._setupDataChannel = function() {
     var label = dc.label;
 
     // This should not be empty.
-    var options = self.labels[label] || {};
+    // NOTE: Multiple DCs are currently not configurable in FF. Will have to
+    // come up with reasonable defaults.
+    var options = self.labels[label] || { label: label };
     var connection  = new DataConnection(self.peer, dc, options);
     delete self.labels[label];
 
@@ -265,9 +267,7 @@ ConnectionManager.prototype._attachConnectionListeners = function(connection) {
   });
   connection.on('open', function() {
     self._lock = false;
-    if (util.browserisms !== 'Firefox') {
-      self._processQueue();
-    }
+    self._processQueue();
   });
 };
 
@@ -366,14 +366,14 @@ ConnectionManager.prototype.connect = function(options) {
   this.labels[options.label] = options;
 
   var dc;
-  if (!!this.pc && !this._lock && util.browserisms !== 'Firefox') {
+  if (!!this.pc && !this._lock && (util.browserisms !== 'Firefox' || Object.keys(this.connections).length !== 0)) {
     dc = this.pc.createDataChannel(options.label, { reliable: false });
   }
   var connection = new DataConnection(this.peer, dc, options);
   this._attachConnectionListeners(connection);
   this.connections[options.label] = connection;
 
-  if (!this.pc || this._lock || util.browserisms === 'Firefox') {
+  if (!dc) {
     this._queued.push(connection);
   }
 

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott