tls,net: fix shutdown issue more cleanly
- tls: do not rely on 'drain' handlers in StreamWrap
'drain'
event handlers may not be invoked if the stream
is currently finishing. Instead, use the fact that we know
when writes are active or not, and invoke the delayed shutdown
handler from our own after-write callback.
- tls: destroy TLS socket if StreamWrap is destroyed
Previously, there was no mechanism in place that would have destroyed the TLS socket once the underlying socket had been closed.
- Revert "net: partially revert "simplify Socket.prototype._final""
This reverts commit ac1f56c7.
Refs: #24288 Refs: #24075
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines