• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3if (!common.hasCrypto)
4  common.skip('missing crypto');
5
6// This test ensures that Node.js doesn't incur a segfault while
7// adding session or keylog listeners after destroy.
8// https://github.com/nodejs/node/issues/38133
9// https://github.com/nodejs/node/issues/38135
10
11const tls = require('tls');
12const tlsSocketKeyLog = tls.connect('cause-error');
13tlsSocketKeyLog.on('error', common.mustCall());
14tlsSocketKeyLog.on('close', common.mustCall(() => {
15  tlsSocketKeyLog.on('keylog', common.mustNotCall());
16}));
17
18const tlsSocketSession = tls.connect('cause-error-2');
19tlsSocketSession.on('error', common.mustCall());
20tlsSocketSession.on('close', common.mustCall(() => {
21  tlsSocketSession.on('session', common.mustNotCall());
22}));
23