mirror of https://github.com/lukechilds/node.git
Browse Source
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>v6
James M Snell
8 years ago
6 changed files with 83 additions and 9 deletions
@ -0,0 +1,27 @@ |
|||||
|
// 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())); |
||||
|
|
||||
|
})); |
||||
|
})); |
Loading…
Reference in new issue