Permalink
Browse files

m2node.run() now returns the handler. This is so that later the socke…

…ts can be closed gracefully with:

handler.pullSocket.close();
handler.pubSocket.close();
  • Loading branch information...
1 parent f9ccf71 commit 566d1acc438cb1288d7f576b5ea7dfcc803971de Paul Bergeron committed Jun 28, 2011
Showing with 5 additions and 1 deletion.
  1. +2 −1 lib/m2node.js
  2. +2 −0 package.json
  3. +1 −0 src/m2node.coffee
View
@@ -6,7 +6,7 @@
exports.run = function(server, options) {
var handler;
handler = new Handler(options);
- return handler.on('request', function(request) {
+ handler.on('request', function(request) {
var fakeSocket;
fakeSocket = new FakeSocket();
fakeSocket.on('write', function() {
@@ -15,5 +15,6 @@
server.emit('connection', fakeSocket);
return fakeSocket.emitData(request.toFullHttpRequest());
});
+ return handler;
};
}).call(this);
View
@@ -5,6 +5,8 @@
"keywords" : ["http", "mongrel2"],
"homepage" : "https://github.com/dan-manges/m2node",
"author" : "Dan Manges <dan.manges@gmail.com> (http://www.dan-manges.com)",
+ "contributors" :
+ [ "Paul Bergeron <paul.d.bergeron@gmail.com>" ],
"main" : "./lib/m2node.js",
"repository" : { "type": "git", "url" : "https://github.com/dan-manges/m2node.git" },
"engines" : { "node": "~0.4.8" },
View
@@ -11,4 +11,5 @@ exports.run = (server, options) ->
handler.sendResponse(request, fakeSocket.writeBuffer)
server.emit 'connection', fakeSocket
fakeSocket.emitData(request.toFullHttpRequest())
+ handler

0 comments on commit 566d1ac

Please sign in to comment.