11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciif (!common.hasCrypto) 41cb0ef41Sopenharmony_ci common.skip('missing crypto'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// This test ensures that Node.js doesn't incur a segfault while 71cb0ef41Sopenharmony_ci// adding session or keylog listeners after destroy. 81cb0ef41Sopenharmony_ci// https://github.com/nodejs/node/issues/38133 91cb0ef41Sopenharmony_ci// https://github.com/nodejs/node/issues/38135 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst tls = require('tls'); 121cb0ef41Sopenharmony_ciconst tlsSocketKeyLog = tls.connect('cause-error'); 131cb0ef41Sopenharmony_citlsSocketKeyLog.on('error', common.mustCall()); 141cb0ef41Sopenharmony_citlsSocketKeyLog.on('close', common.mustCall(() => { 151cb0ef41Sopenharmony_ci tlsSocketKeyLog.on('keylog', common.mustNotCall()); 161cb0ef41Sopenharmony_ci})); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciconst tlsSocketSession = tls.connect('cause-error-2'); 191cb0ef41Sopenharmony_citlsSocketSession.on('error', common.mustCall()); 201cb0ef41Sopenharmony_citlsSocketSession.on('close', common.mustCall(() => { 211cb0ef41Sopenharmony_ci tlsSocketSession.on('session', common.mustNotCall()); 221cb0ef41Sopenharmony_ci})); 23