Skip to content
Browse files

Cleanup after node06 branch-merge.

  • Loading branch information...
1 parent 45d9276 commit e5db7d530ee3762933f69545b96f672d9422b4a5 @mde mde committed Dec 1, 2011
Showing with 53 additions and 0 deletions.
  1. +13 −0 lib/geddy.js
  2. +40 −0 lib/in_flight.js
View
13 lib/geddy.js
@@ -0,0 +1,13 @@
+
+var geddy = global.geddy || {}
+ , utils;
+
+global.geddy = geddy;
+utils = require('./utils/index');
+// Hang all the util namespaces on the global geddy
+for (var p in utils) {
+ geddy[p] = utils[p];
+}
+// Could also be used as export/local
+module.exports = geddy;
+
View
40 lib/in_flight.js
@@ -0,0 +1,40 @@
+
+var InFlight = function () {
+ this.entries = {};
+};
+
+InFlight.prototype = new (function () {
+ this.addEntry = function (req, method, resp, accessTime) {
+ var id = geddy.string.uuid();
+ req._geddyId = id;
+ resp._geddyId = id;
+ this.entries[id] = {
+ request: req
+ , method: method
+ , response: resp
+ , accessTime: accessTime
+ };
+ this.addListeners(req, resp);
+ };
+
+ this.removeEntry = function (id) {
+ delete this.entries[id];
+ };
+
+ this.addListeners = function (req, resp) {
+ var self = this;
+ req.addListener('end', function () {
+ id = req._geddyId
+ , entry = self.entries[id];
+ geddy.log.access(req.connection.remoteAddress +
+ " " + new Date(entry.accessTime) + " " + entry.method + " " + req.url);
+ });
+
+ resp.addListener('end', function () {
+ });
+
+
+ };
+})();
+
+module.exports.InFlight = InFlight;

0 comments on commit e5db7d5

Please sign in to comment.
Something went wrong with that request. Please try again.