summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-server-session-destroy.js
diff options
context:
space:
mode:
authorleeight <leeight@gmail.com>2018-11-21 16:53:15 +0800
committerRich Trott <rtrott@gmail.com>2018-11-24 18:19:11 -0800
commit895fe2f574cc09eaadb8e9157c46751d9cdf7e51 (patch)
treeed144c12106bbad3f481e85070c0c0e2a6865bd6 /test/parallel/test-http2-server-session-destroy.js
parenta57343c72730bc26086fa3e358581e0ade4849d0 (diff)
downloadandroid-node-v8-895fe2f574cc09eaadb8e9157c46751d9cdf7e51.tar.gz
android-node-v8-895fe2f574cc09eaadb8e9157c46751d9cdf7e51.tar.bz2
android-node-v8-895fe2f574cc09eaadb8e9157c46751d9cdf7e51.zip
http2: fix session[kSession] undefined issue
`finishSessionDestroy` session cleanup when already done. PR-URL: https://github.com/nodejs/node/pull/24547 Fixes: https://github.com/nodejs/node/issues/24546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-server-session-destroy.js')
-rw-r--r--test/parallel/test-http2-server-session-destroy.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/parallel/test-http2-server-session-destroy.js b/test/parallel/test-http2-server-session-destroy.js
new file mode 100644
index 0000000000..9b7f126510
--- /dev/null
+++ b/test/parallel/test-http2-server-session-destroy.js
@@ -0,0 +1,20 @@
+'use strict';
+
+const common = require('../common');
+if (!common.hasCrypto)
+ common.skip('missing crypto');
+const h2 = require('http2');
+
+const server = h2.createServer();
+server.listen(0, common.localhostIPv4, common.mustCall(() => {
+ const afterConnect = common.mustCall((session) => {
+ session.request({ ':method': 'POST' }).end(common.mustCall(() => {
+ session.destroy();
+ server.close();
+ }));
+ });
+
+ const port = server.address().port;
+ const host = common.localhostIPv4;
+ h2.connect('http://' + host + ':' + port, afterConnect);
+}));