fixed some syntax mistakes.

This commit is contained in:
yosssi 2013-10-07 10:22:14 +09:00
parent 72998056e0
commit 974f00c996
2 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ function PeerServer(options) {
this._ips = {};
this._setCleanupIntervals();
};
}
util.inherits(PeerServer, EventEmitter);
@ -131,8 +131,8 @@ PeerServer.prototype._configureWS = function(socket, key, id, token) {
// Clean up if a Peer sends a LEAVE.
if (!message.dst) {
self._removePeer(key, id);
break;
}
break;
// ICE candidates
case 'CANDIDATE':
// Offer or answer between peers.
@ -150,11 +150,11 @@ PeerServer.prototype._configureWS = function(socket, key, id, token) {
util.prettyError('Message unrecognized');
}
} catch(e) {
throw e;
util.log('Invalid message', data);
throw e;
}
});
}
};
PeerServer.prototype._checkKey = function(key, ip, cb) {
@ -181,14 +181,14 @@ PeerServer.prototype._checkKey = function(key, ip, cb) {
} else {
cb('Invalid key provided');
}
}
};
/** Initialize HTTP server routes. */
PeerServer.prototype._initializeHTTP = function() {
var self = this;
this._app.use(restify.bodyParser({ mapParams: false }));
this._app.use(restify.queryParser())
this._app.use(restify.queryParser());
this._app.use(util.allowCrossDomain);
// Retrieve guaranteed random ID.
@ -332,7 +332,7 @@ PeerServer.prototype._setCleanupIntervals = function() {
var keys = Object.keys(self._ips);
for (var i = 0, ii = keys.length; i < ii; i += 1) {
var key = keys[i];
if (self._ips[key] == 0) {
if (self._ips[key] === 0) {
delete self._ips[key];
}
}
@ -383,7 +383,7 @@ PeerServer.prototype._handleTransmission = function(key, message) {
destination.res.write(data);
} else {
// Neither socket no res available. Peer dead?
throw "Peer dead"
throw "Peer dead";
}
} catch (e) {
// This happens when a peer disconnects without closing connections and

View File

@ -13,7 +13,7 @@ var util = {
});
},
extend: function(dest, source) {
source = source || {}
source = source || {};
for(var key in source) {
if(source.hasOwnProperty(key)) {
dest[key] = source[key];