Skip to content
Browse files

Merge pull request #9 from naeims/master

Fix stream.write() and server.emit() overrides to call the original methods with the correct this context
  • Loading branch information...
2 parents 276c1b3 + 176d80c commit 9134b1728cd469eaa69dfa36f3a6080117d1cb30 @rohiniwork rohiniwork committed Feb 11, 2014
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/monitor.js
View
6 lib/monitor.js
@@ -47,7 +47,7 @@ ReqCounter.prototype.registerEvents = function (server) {
server.emit = function () {
var args = arguments;
if (args[0] !== 'connection' && args[0] !== 'request') {
- origEmit.apply(server, arguments);
+ origEmit.apply(this, arguments);
return;
}
@@ -65,7 +65,7 @@ ReqCounter.prototype.registerEvents = function (server) {
if (data && data.length) {
that._transfered += data.length;
}
- origWrite.apply(stream, arguments);
+ origWrite.apply(this, arguments);
};
stream.on('close', function () {
@@ -103,7 +103,7 @@ ReqCounter.prototype.registerEvents = function (server) {
};
/*jslint plusplus:true*/
}
- origEmit.apply(server, arguments);
+ origEmit.apply(this, arguments);
};
};

0 comments on commit 9134b17

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