| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,7 +46,7 @@ function run() { | |||
| 46 | 46 | } | |
| 47 | 47 | } else { // HTTP/2 | |
| 48 | 48 | const client = http.connect(url); | |
| 49 | - client.on('error', (e) => { throw e; }); | ||
| 49 | + client.on('error', () => {}); | ||
| 50 | 50 | request(client.request(), client); | |
| 51 | 51 | } | |
| 52 | 52 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,9 +24,10 @@ function main({ requests, streams, clients, duration }) { | |||
| 24 | 24 | res.destroy(); | |
| 25 | 25 | }); | |
| 26 | 26 | }); | |
| 27 | - server.listen(common.PORT, () => { | ||
| 27 | + server.listen(0, () => { | ||
| 28 | 28 | bench.http({ | |
| 29 | 29 | path: '/', | |
| 30 | + port: server.address().port, | ||
| 30 | 31 | requests, | |
| 31 | 32 | maxConcurrentStreams: streams, | |
| 32 | 33 | clients, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../common.js'); | |
| 4 | - const PORT = common.PORT; | ||
| 5 | 4 | ||
| 6 | 5 | const bench = common.createBenchmark(main, { | |
| 7 | 6 | n: [1e3], | |
@@ -32,8 +31,8 @@ function main({ n, nheaders }) { | |||
| 32 | 31 | stream.respond(); | |
| 33 | 32 | stream.end('Hi!'); | |
| 34 | 33 | }); | |
| 35 | - server.listen(PORT, () => { | ||
| 36 | - const client = http2.connect(`http://localhost:${PORT}/`, { | ||
| 34 | + server.listen(0, () => { | ||
| 35 | + const client = http2.connect(`http://localhost:${server.address().port}/`, { | ||
| 37 | 36 | maxHeaderListPairs: 20000 | |
| 38 | 37 | }); | |
| 39 | 38 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,10 +25,11 @@ function main({ requests, streams, clients, duration }) { | |||
| 25 | 25 | stream.respondWithFD(fd); | |
| 26 | 26 | stream.on('error', (err) => {}); | |
| 27 | 27 | }); | |
| 28 | - server.listen(common.PORT, () => { | ||
| 28 | + server.listen(0, () => { | ||
| 29 | 29 | bench.http({ | |
| 30 | 30 | path: '/', | |
| 31 | 31 | requests, | |
| 32 | + port: server.address().port, | ||
| 32 | 33 | maxConcurrentStreams: streams, | |
| 33 | 34 | clients, | |
| 34 | 35 | duration, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,9 +22,10 @@ function main({ requests, streams, clients, duration }) { | |||
| 22 | 22 | out.pipe(stream); | |
| 23 | 23 | stream.on('error', (err) => {}); | |
| 24 | 24 | }); | |
| 25 | - server.listen(common.PORT, () => { | ||
| 25 | + server.listen(0, () => { | ||
| 26 | 26 | bench.http({ | |
| 27 | 27 | path: '/', | |
| 28 | + port: server.address().port, | ||
| 28 | 29 | requests, | |
| 29 | 30 | maxConcurrentStreams: streams, | |
| 30 | 31 | clients, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,9 +26,10 @@ function main({ streams, length, size, duration }) { | |||
| 26 | 26 | } | |
| 27 | 27 | write(); | |
| 28 | 28 | }); | |
| 29 | - server.listen(common.PORT, () => { | ||
| 29 | + server.listen(0, () => { | ||
| 30 | 30 | bench.http({ | |
| 31 | 31 | path: '/', | |
| 32 | + port: server.address().port, | ||
| 32 | 33 | requests: 10000, | |
| 33 | 34 | duration, | |
| 34 | 35 | maxConcurrentStreams: streams, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments