diff --git a/lib/config-loader.js b/lib/config-loader.js index 2e8c6d1..781875d 100644 --- a/lib/config-loader.js +++ b/lib/config-loader.js @@ -25,8 +25,6 @@ module.exports.loadConfig = function(basepath, server, fn) { , src = {} , error; - var $DEBUGTRACE = false; - server.__resourceCache = null; if(resources.length) { @@ -49,12 +47,6 @@ module.exports.loadConfig = function(basepath, server, fn) { remaining = -1; finished = true; - if ($DEBUGTRACE) { - console.log("First trace", $DEBUGTRACE); - console.trace("Current trace"); - } - $DEBUGTRACE = new Error().stack; - var InternalResources = require('./resources/internal-resources'); debug('done, adding internals'); diff --git a/lib/router.js b/lib/router.js index 7ea2912..b130e03 100644 --- a/lib/router.js +++ b/lib/router.js @@ -36,6 +36,12 @@ Router.prototype.route = function (req, res) { , i = 0 , globals = 0; + if (req._routed) { + return; + } + + req._routed = true; + function next() { globals++; return function() { diff --git a/lib/server.js b/lib/server.js index 15d860e..6a98555 100644 --- a/lib/server.js +++ b/lib/server.js @@ -52,9 +52,6 @@ function Server(options) { var server = this; http.Server.call(this); - var $DEBUGSTREAM = fs.createWriteStream("crashes.log", {flags: 'r+'}) - , $CRASHES = 0; - // defaults this.options = options = extend({ port: 2403, @@ -81,7 +78,6 @@ function Server(options) { var keys = this.keys = new Keys(); this.on('request', function (req, res) { - $DEBUGSTREAM.write(req.method + " " + req.url + "\r\n"); if(req.url.indexOf('/socket.io/') === 0) return; @@ -109,14 +105,6 @@ function Server(options) { } var router = new Router(resourcesInstances, server); server.router = router; - - if (res.$DEBUGFLAG) { - $DEBUGSTREAM.write("CRASH on " + req.method + " " + req.url + "\r\n"); - $CRASHES++; - console.log("Crashes: ", $CRASHES); - return; - } - res.$DEBUGFLAG = true; server.resources = resourcesInstances; router.route(req, res);