Closed
Description
- Version:v10.13.0
- Platform:Darwin Kernel Version 18.2.0
- Subsystem:TLSSocket
Run below snippet on Node 10, the close
listener will never be trigged.
If we comment out the line socket.removeAllListeners('end');
, The close listener is trigged as expected.
But on Nodejs 8, close listener works with or without the removeAllListeners
call.
const tls = require('tls');
const options = {
host : "www.baidu.com",
port: 443,
};
const socket = tls.connect(options, () => {
console.log('===client connected');
socket.end();
});
socket.removeAllListeners('end');
socket.on('end', () => {
console.log('===client ends');
});
socket.on('close', ()=> {
console.log('===client close' );
});
Output in Nodejs 10:
===client connected
===client ends
Output in Nodejs 8:
===client connected
===client ends
===client close
I believe this issue is the root cause of ldapjs/node-ldapjs#483