mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

Update var to let/const and replace arbitrary timeout. PR-URL: https://github.com/nodejs/node/pull/10064 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
29 lines
504 B
JavaScript
29 lines
504 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const tls = require('tls');
|
|
const stream = require('stream');
|
|
|
|
const delay = new stream.Duplex({
|
|
read: function read() {
|
|
},
|
|
write: function write(data, enc, cb) {
|
|
console.log('pending');
|
|
setImmediate(function() {
|
|
console.log('done');
|
|
cb();
|
|
});
|
|
}
|
|
});
|
|
|
|
const secure = tls.connect({
|
|
socket: delay
|
|
});
|
|
setImmediate(function() {
|
|
secure.destroy();
|
|
});
|