Permalink
Browse files

engine.io: some cleanup

  • Loading branch information...
1 parent 92df787 commit 971199d19bb4a4e4f3f60df38c52fb34f0f0d26d @rauchg rauchg committed Nov 4, 2012
Showing with 13 additions and 12 deletions.
  1. +13 −12 lib/engine.io.js
View
@@ -3,7 +3,7 @@
*/
var http = require('http')
- , debug = require('debug')('engine:core')
+ , debug = require('debug')('engine:core');
/**
* Protocol revision number.
@@ -93,10 +93,10 @@ exports.listen = function (port, options, fn) {
*/
exports.attach = function (server, options) {
- var engine = new exports.Server(options)
- , options = options || {}
- , path = (options.path || '/engine.io').replace(/\/$/, '')
- , resource = options.resource || 'default'
+ var engine = new exports.Server(options);
+ var options = options || {};
+ var path = (options.path || '/engine.io').replace(/\/$/, '');
+ var resource = options.resource || 'default';
// normalize path
path += '/' + resource + '/';
@@ -106,8 +106,8 @@ exports.attach = function (server, options) {
}
// cache and clean up listeners
- var listeners = server.listeners('request')
- , oldListeners = []
+ var listeners = server.listeners('request');
+ var oldListeners = [];
// copy the references onto a new array for node >=0.7
for (var i = 0, l = listeners.length; i < l; i++) {
@@ -142,8 +142,10 @@ exports.attach = function (server, options) {
});
}
- if (~engine.transports.indexOf('flashsocket')
- && false !== options.policyFile) {
+ // flash policy file
+ var trns = engine.transports;
+ var policy = options.policyFile;
+ if (~trns.indexOf('flashsocket') && false !== policy) {
server.on('connection', function (socket) {
engine.handleSocket(socket);
});
@@ -152,7 +154,6 @@ exports.attach = function (server, options) {
return engine;
};
-
/**
* Invoking the library as a function delegates to attach
*
@@ -164,6 +165,6 @@ exports.attach = function (server, options) {
module.exports = function() {
return exports.attach.apply(this, arguments);
-}
+};
-module.exports.__proto__ = exports;
+module.exports.__proto__ = exports;

0 comments on commit 971199d

Please sign in to comment.