Skip to content

Commit

Permalink
benchmark: Fix crash in net benchmarks
Browse files Browse the repository at this point in the history
Net benchmarks create partial event emitters that do not have all of the
required event emitter functions. They currently mock out `on`, `once`,
and `emit` functions. This change mocks out `prependListener` as well to
avoid crashing in `_stream_readable`.

PR-URL: https://www.github.com/nodejs/node/pull/6407
Fixes: https://www.github.com/nodejs/node/issues/6405
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Matt Loring committed Apr 28, 2016
1 parent 3cdb506 commit 89164a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};

function server() {
var writer = new Writer();
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function Reader() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function Reader() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function Reader() {
Expand Down

0 comments on commit 89164a0

Please sign in to comment.