mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 08:53:12 +00:00

Fixes: https://github.com/nodejs/http2/issues/179 Was fixing issue #179 and encountered a segault that was happening somewhat randomly on session destruction. Both should be fixed PR-URL: https://github.com/nodejs/node/pull/14239 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
28 lines
711 B
JavaScript
Executable File
28 lines
711 B
JavaScript
Executable File
// Flags: --expose-http2
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const http2 = require('http2');
|
|
|
|
const server = http2.createServer();
|
|
server.setTimeout(common.platformTimeout(1));
|
|
|
|
const onServerTimeout = common.mustCall((session) => {
|
|
session.destroy();
|
|
server.removeListener('timeout', onServerTimeout);
|
|
});
|
|
|
|
server.on('stream', common.mustNotCall());
|
|
server.on('timeout', onServerTimeout);
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const url = `http://localhost:${server.address().port}`;
|
|
const client = http2.connect(url);
|
|
client.on('close', common.mustCall(() => {
|
|
|
|
const client2 = http2.connect(url);
|
|
client2.on('close', common.mustCall(() => server.close()));
|
|
|
|
}));
|
|
}));
|