Permalink
Browse files

Fix stream.write() and server.emit() overrides to call the original

methods with the correct this context.

Contributed on behalf of Box Inc.
  • Loading branch information...
1 parent 276c1b3 commit 176d80cfe25d42e68f6f5748fdb874f9dbb1a2c1 @naeims naeims committed Feb 7, 2014
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/monitor.js
View
@@ -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 176d80c

Please sign in to comment.