|
@@ -34,7 +34,6 @@ Negotiator.startConnection = function(type, peer, connection, provider, options)
|
|
dc = pc.createDataChannel(options.label, {reliable: reliable});
|
|
dc = pc.createDataChannel(options.label, {reliable: reliable});
|
|
connection = provider.getConnection(peer, connection);
|
|
connection = provider.getConnection(peer, connection);
|
|
connection.initialize(dc);
|
|
connection.initialize(dc);
|
|
- Negotiator._attachConnectionListeners(dc);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (!util.supports.onnegotiationneeded) {
|
|
if (!util.supports.onnegotiationneeded) {
|
|
@@ -121,7 +120,6 @@ Negotiator._setupListeners = function(peer, provider, pc, id) {
|
|
var dc = evt.channel;
|
|
var dc = evt.channel;
|
|
connection = provider.getConnection(peer, connection);
|
|
connection = provider.getConnection(peer, connection);
|
|
connection.initialize(dc);
|
|
connection.initialize(dc);
|
|
- Negotiator._attachConnectionListeners(dc);
|
|
|
|
};
|
|
};
|
|
|
|
|
|
// MEDIACONNECTION.
|
|
// MEDIACONNECTION.
|
|
@@ -225,24 +223,6 @@ ConnectionManager.prototype._cleanup = function() {
|
|
this.emit('close');
|
|
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. */
|
|
/** Handle an SDP. */
|
|
ConnectionManager.prototype.handleSDP = function(sdp, type, call) {
|
|
ConnectionManager.prototype.handleSDP = function(sdp, type, call) {
|
|
sdp = new RTCSessionDescription(sdp);
|
|
sdp = new RTCSessionDescription(sdp);
|