Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
tls: remove unnecessary close listener …#34105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling.
ronag commented Jun 28, 2020
As a side note... there is a lot that could be improved in the tls code... However, it's kind of risky and difficult to work with. Is this something we would like to do or should I just leave it alone? |
nodejs-github-bot commented Jun 28, 2020
nodejs-github-bot commented Jun 29, 2020
addaleax commented Jun 29, 2020
I think it’s similar to streams – it’s hard to work with until somebody puts in a lot of work to clear it up. :/ |
nodejs-github-bot commented Jun 29, 2020
nodejs-github-bot commented Jul 1, 2020
nodejs-github-bot commented Jul 1, 2020
ronag commented Jul 1, 2020
Landed in 60a217b |
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Wrapped streams are expected to behave the same as socket with handle. Remove unnecessary difference in handling. PR-URL: #34105 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
panmenghan commented Oct 10, 2020
@ronag consthttp2=require('http2')constnet=require('net')const{Duplex}=require('stream')classJsSocketextendsDuplex{constructor(socket){super({autoDestroy: true,allowHalfOpen: false})socket.on('data',(data)=>this.push(data))socket.on('end',(data)=>this.push(null))socket.on('close',()=>this.destroy())this.socket=socket}unref(){}ref(){}setNoDelay(){}setTimeout(){}_write(data,encoding,callback){this.socket.write(data,encoding,callback)}_final(callback){callback()}_read(size){}_destroy(error,callback){callback()}}constrealSocket=net.connect({host: 'www.example.com',port: '443'},()=>{console.log('connected')constconnection=http2.connect('https://www.example.com',{socket: newJsSocket(realSocket),// crash!!!// socket: realSocket, // but not crash!!!})consth2Stream=connection.request({[http2.constants.HTTP2_HEADER_PATH]: '/'})setTimeout(()=>{realSocket.destroy()},2e3)setTimeout(()=>{connection.close()},3e3)})output: |
Wrapped streams are expected to behave the same as socket with handle.
Remove unnecessary difference in handling.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes