delayed connected was not working for socket candidates
This commit is contained in:
parent
0d264b4119
commit
d998280445
@ -113,16 +113,19 @@ PeerServer.prototype._initializeWSS = function() {
|
||||
|
||||
/** Process outstanding peer offers. */
|
||||
PeerServer.prototype._processOutstandingOffers = function(id) {
|
||||
console.log('processing outstanding offers');
|
||||
var offers = this._outstandingOffers[id];
|
||||
for (var source in offers) {
|
||||
if (offers.hasOwnProperty(source)) {
|
||||
var messages = offers[source]
|
||||
for (var i = 0; i < messages.length; i += 1)
|
||||
this._handleTransmission.apply(this, messages[i]);
|
||||
if (offers === undefined)
|
||||
return;
|
||||
var sources = Object.keys(offers);
|
||||
for (var i = 0, ii = sources.length; i < ii; i += 1) {
|
||||
var messages = offers[sources[i]];
|
||||
for (var j = 0, jj = messages.length; j < jj; j += 1)
|
||||
this._handleTransmission.apply(this, messages[j]);
|
||||
|
||||
delete this._outstandingOffers[id][source];
|
||||
}
|
||||
delete this._outstandingOffers[id][sources[i]];
|
||||
}
|
||||
console.log(this._outstandingOffers[id]);
|
||||
};
|
||||
|
||||
/** Initialize HTTP server routes. */
|
||||
@ -160,7 +163,7 @@ PeerServer.prototype._initializeHTTP = function() {
|
||||
this._app.post('/ice', function(req, res) {
|
||||
var src = req.body.src;
|
||||
var dst = req.body.dst;
|
||||
self._handleTransmission('ICE', src, dst, JSON.stringify(req.body), res);
|
||||
self._handleTransmission('CANDIDATE', src, dst, JSON.stringify(req.body), res);
|
||||
});
|
||||
|
||||
this._app.post('/answer', function(req, res) {
|
||||
@ -242,11 +245,13 @@ PeerServer.prototype._handleTransmission = function(type, src, dst, data, res) {
|
||||
this._outstandingOffers[dst][src] = [];
|
||||
this._outstandingOffers[dst][src].push(Array.prototype.slice.apply(arguments));
|
||||
|
||||
console.log('offer on queue');
|
||||
setTimeout(function() {
|
||||
delete self._outstandingOffers[dst][src]
|
||||
}, 5000);
|
||||
} else if (type === 'ICE' && !!this._outstandingOffers[dst][src]) {
|
||||
}, 30000);
|
||||
} else if (type === 'CANDIDATE' && !!this._outstandingOffers[dst][src]) {
|
||||
this._outstandingOffers[dst][src].push(Array.prototype.slice.apply(arguments));
|
||||
console.log('ice on queue');
|
||||
} else {
|
||||
// Assume a disconnect if the client no longer exists.
|
||||
util.log('destination does not exist');
|
||||
|
Loading…
x
Reference in New Issue
Block a user