- 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.
consttls=require('tls');constoptions={host : "www.baidu.com",port: 443,};constsocket=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
Run below snippet on Node 10, the
closelistener 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
removeAllListenerscall.Output in Nodejs 10:
Output in Nodejs 8:
I believe this issue is the root cause of ldapjs/node-ldapjs#483