| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f71b09f commit fa677ca
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,24 +21,29 @@ fs.readFile(loc, common.mustCall((err, data) => { | |||
| 21 | 21 | fileData = data; | |
| 22 | 22 | ||
| 23 | 23 | const server = http2.createServer(); | |
| 24 | + let client; | ||
| 25 | + | ||
| 26 | + const countdown = new Countdown(3, () => { | ||
| 27 | + server.close(); | ||
| 28 | + client.close(); | ||
| 29 | + }); | ||
| 24 | 30 | ||
| 25 | 31 | server.on('stream', common.mustCall((stream) => { | |
| 26 | 32 | let data = Buffer.alloc(0); | |
| 27 | 33 | stream.on('data', (chunk) => data = Buffer.concat([data, chunk])); | |
| 28 | 34 | stream.on('end', common.mustCall(() => { | |
| 29 | 35 | assert.deepStrictEqual(data, fileData); | |
| 30 | 36 | })); | |
| 37 | + // Waiting on close avoids spurious ECONNRESET seen in windows CI. | ||
| 38 | + // Not sure if this is actually a bug; more details at | ||
| 39 | + // https://github.com/nodejs/node/issues/20750#issuecomment-511015247 | ||
| 40 | + stream.on('close', () => countdown.dec()); | ||
| 31 | 41 | stream.respond(); | |
| 32 | 42 | stream.end(); | |
| 33 | 43 | })); | |
| 34 | 44 | ||
| 35 | 45 | server.listen(0, common.mustCall(() => { | |
| 36 | - const client = http2.connect(`http://localhost:${server.address().port}`); | ||
| 37 | - | ||
| 38 | - const countdown = new Countdown(2, () => { | ||
| 39 | - server.close(); | ||
| 40 | - client.close(); | ||
| 41 | - }); | ||
| 46 | + client = http2.connect(`http://localhost:${server.address().port}`); | ||
| 42 | 47 | ||
| 43 | 48 | const req = client.request({ ':method': 'POST' }); | |
| 44 | 49 | req.on('response', common.mustCall()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments