@@ -10,6 +10,7 @@ const configs = {
|
10 | 10 | }; |
11 | 11 | |
12 | 12 | const bench = common.createBenchmark(main, configs); |
| 13 | +const noop = () => {}; |
13 | 14 | |
14 | 15 | function main(conf) { |
15 | 16 | const n = +conf.n; |
@@ -19,19 +20,27 @@ function main(conf) {
|
19 | 20 | if (port !== undefined && address !== undefined) { |
20 | 21 | bench.start(); |
21 | 22 | for (let i = 0; i < n; i++) { |
22 | | -dgram.createSocket('udp4').bind(port, address).unref(); |
| 23 | +dgram.createSocket('udp4').bind(port, address) |
| 24 | +.on('error', noop) |
| 25 | +.unref(); |
23 | 26 | } |
24 | 27 | bench.end(n); |
25 | 28 | } else if (port !== undefined) { |
26 | 29 | bench.start(); |
27 | 30 | for (let i = 0; i < n; i++) { |
28 | | -dgram.createSocket('udp4').bind(port).unref(); |
| 31 | +dgram.createSocket('udp4') |
| 32 | +.bind(port) |
| 33 | +.on('error', noop) |
| 34 | +.unref(); |
29 | 35 | } |
30 | 36 | bench.end(n); |
31 | 37 | } else if (port === undefined && address === undefined) { |
32 | 38 | bench.start(); |
33 | 39 | for (let i = 0; i < n; i++) { |
34 | | -dgram.createSocket('udp4').bind().unref(); |
| 40 | +dgram.createSocket('udp4') |
| 41 | +.bind() |
| 42 | +.on('error', noop) |
| 43 | +.unref(); |
35 | 44 | } |
36 | 45 | bench.end(n); |
37 | 46 | } |
|