mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
5374e15d24
Don't destroy the socket when closing the session but let it end gracefully. Also, when destroying the session, on Windows, we would get ECONNRESET errors, make sure we take those into account in our tests. PR-URL: https://github.com/nodejs/node/pull/45115 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
28 lines
622 B
JavaScript
28 lines
622 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const Countdown = require('../common/countdown');
|
|
const http2 = require('http2');
|
|
|
|
const server = http2.createServer();
|
|
|
|
let session;
|
|
|
|
const countdown = new Countdown(2, () => {
|
|
server.close(common.mustSucceed());
|
|
session.close();
|
|
});
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const client = http2.connect(`http://localhost:${server.address().port}`);
|
|
client.on('connect', common.mustCall(() => countdown.dec()));
|
|
}));
|
|
|
|
server.on('session', common.mustCall((s) => {
|
|
session = s;
|
|
countdown.dec();
|
|
}));
|