Skip to content

Commit 7b9ae70

Browse files
Matt LoringFishrock123
Matt Loring
authored andcommitted
benchmark: Fix crash in net benchmarks
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 <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Matthew Loring <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 11e7cc5 commit 7b9ae70

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

benchmark/net/net-c2s-cork.js

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
6262
Writer.prototype.on = function() {};
6363
Writer.prototype.once = function() {};
6464
Writer.prototype.emit = function() {};
65+
Writer.prototype.prependListener = function() {};
6566

6667
function server() {
6768
var writer = new Writer();

benchmark/net/net-c2s.js

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
6262
Writer.prototype.on = function() {};
6363
Writer.prototype.once = function() {};
6464
Writer.prototype.emit = function() {};
65+
Writer.prototype.prependListener = function() {};
6566

6667

6768
function Reader() {

benchmark/net/net-pipe.js

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
6262
Writer.prototype.on = function() {};
6363
Writer.prototype.once = function() {};
6464
Writer.prototype.emit = function() {};
65+
Writer.prototype.prependListener = function() {};
6566

6667

6768
function Reader() {

benchmark/net/net-s2c.js

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
6262
Writer.prototype.on = function() {};
6363
Writer.prototype.once = function() {};
6464
Writer.prototype.emit = function() {};
65+
Writer.prototype.prependListener = function() {};
6566

6667

6768
function Reader() {

0 commit comments

Comments
 (0)