diff --git a/benchmark/dgram/bind-params.js b/benchmark/dgram/bind-params.js index 6f641f7f570667..ae179f4ffce8a7 100644 --- a/benchmark/dgram/bind-params.js +++ b/benchmark/dgram/bind-params.js @@ -10,6 +10,7 @@ const configs = { }; const bench = common.createBenchmark(main, configs); +const noop = () => {}; function main(conf) { const n = +conf.n; @@ -19,19 +20,27 @@ function main(conf) { if (port !== undefined && address !== undefined) { bench.start(); for (let i = 0; i < n; i++) { - dgram.createSocket('udp4').bind(port, address).unref(); + dgram.createSocket('udp4').bind(port, address) + .on('error', noop) + .unref(); } bench.end(n); } else if (port !== undefined) { bench.start(); for (let i = 0; i < n; i++) { - dgram.createSocket('udp4').bind(port).unref(); + dgram.createSocket('udp4') + .bind(port) + .on('error', noop) + .unref(); } bench.end(n); } else if (port === undefined && address === undefined) { bench.start(); for (let i = 0; i < n; i++) { - dgram.createSocket('udp4').bind().unref(); + dgram.createSocket('udp4') + .bind() + .on('error', noop) + .unref(); } bench.end(n); }