| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d364f9c commit a40ee21
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,13 +3,12 @@ | |||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | if (!common.hasCrypto) | |
| 5 | 5 | common.skip('missing crypto'); | |
| 6 | - const h2 = require('http2'); | ||
| 6 | + const http2 = require('http2'); | ||
| 7 | 7 | ||
| 8 | 8 | const serverTimeout = common.platformTimeout(200); | |
| 9 | - const callTimeout = common.platformTimeout(20); | ||
| 10 | 9 | const mustNotCall = common.mustNotCall(); | |
| 11 | 10 | ||
| 12 | - const server = h2.createServer(); | ||
| 11 | + const server = http2.createServer(); | ||
| 13 | 12 | server.timeout = serverTimeout; | |
| 14 | 13 | ||
| 15 | 14 | server.on('request', (req, res) => res.end()); | |
@@ -19,7 +18,7 @@ server.listen(0, common.mustCall(() => { | |||
| 19 | 18 | const port = server.address().port; | |
| 20 | 19 | ||
| 21 | 20 | const url = `http://localhost:${port}`; | |
| 22 | - const client = h2.connect(url); | ||
| 21 | + const client = http2.connect(url); | ||
| 23 | 22 | const startTime = process.hrtime(); | |
| 24 | 23 | makeReq(); | |
| 25 | 24 | ||
@@ -37,7 +36,7 @@ server.listen(0, common.mustCall(() => { | |||
| 37 | 36 | const diff = process.hrtime(startTime); | |
| 38 | 37 | const milliseconds = (diff[0] * 1e3 + diff[1] / 1e6); | |
| 39 | 38 | if (milliseconds < serverTimeout * 2) { | |
| 40 | - setTimeout(makeReq, callTimeout); | ||
| 39 | + setImmediate(makeReq); | ||
| 41 | 40 | } else { | |
| 42 | 41 | server.removeListener('timeout', mustNotCall); | |
| 43 | 42 | server.close(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments