Michelle Bu 12 سال پیش
والد
کامیت
f2df4f3de1
1فایلهای تغییر یافته به همراه0 افزوده شده و 20 حذف شده
  1. 0 20
      lib/negotiator.js

+ 0 - 20
lib/provider.js → lib/negotiator.js

@@ -34,7 +34,6 @@ Negotiator.startConnection = function(type, peer, connection, provider, options)
       dc = pc.createDataChannel(options.label, {reliable: reliable});
       connection = provider.getConnection(peer, connection);
       connection.initialize(dc);
-      Negotiator._attachConnectionListeners(dc);
     }
 
     if (!util.supports.onnegotiationneeded) {
@@ -121,7 +120,6 @@ Negotiator._setupListeners = function(peer, provider, pc, id) {
     var dc = evt.channel;
     connection = provider.getConnection(peer, connection);
     connection.initialize(dc);
-    Negotiator._attachConnectionListeners(dc);
   };
 
   // MEDIACONNECTION.
@@ -225,24 +223,6 @@ ConnectionManager.prototype._cleanup = function() {
   this.emit('close');
 }
 
-/** Attach connection listeners. */
-ConnectionManager.prototype._attachConnectionListeners = function(connection) {
-  var self = this;
-  connection.on('close', function() {
-    if (!!self.connections[connection.label]) {
-      delete self.connections[connection.label];
-    }
-
-    if (!Object.keys(self.connections).length) {
-      self._cleanup();
-    }
-  });
-  connection.on('open', function() {
-    self._lock = false;
-    self._processQueue();
-  });
-}
-
 /** Handle an SDP. */
 ConnectionManager.prototype.handleSDP = function(sdp, type, call) {
   sdp = new RTCSessionDescription(sdp);