Simplified transport upgrade possibilities computation

This commit is contained in:
Guillermo Rauch
2012-01-03 10:32:25 -08:00
parent 2819a0c4cf
commit ba3a85cd31

View File

@@ -57,26 +57,17 @@ Server.prototype.__proto__ = EventEmitter.prototype;
Server.prototype.clients;
/**
* Returns a list of available transports for upgrade.
* Returns a list of available transports for upgrade given a certain transport.
*
* @return {Array}
* @api public
*/
Server.prototype.upgrades = function () {
var available = this.transports
, upgrades = []
for (var i in transports) {
if (~available.indexOf(i) && transports[i].prototype.isUpgrade) {
upgrades.push(i);
}
}
return upgrades;
Server.prototype.upgrades = function (transport) {
if (!this.allowUpgrades) return [];
return transports[transport].upgradesTo || [];
};
/**
* Verifies a request.
*