-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http2: guard against destroyed session, timeouts
Guard against destroyed session in timeouts and goaway event. Improve timeout handling a bit. PR-URL: #15106 Fixes: #14964 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
1 parent
886612f
commit 0146a54
Showing
3 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Flags: --expose-http2 | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
const http2 = require('http2'); | ||
|
||
const server = http2.createServer(); | ||
server.on('stream', common.mustCall((stream) => { | ||
stream.on('error', common.mustCall()); | ||
stream.session.shutdown(); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const client = http2.connect(`http://localhost:${server.address().port}`); | ||
|
||
client.on('goaway', common.mustCall(() => { | ||
// We ought to be able to destroy the client in here without an error | ||
server.close(); | ||
client.destroy(); | ||
})); | ||
|
||
client.request(); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters