tls: Destroy socket when encrypted side closes
authorisaacs <i@izs.me>
Sat, 30 Mar 2013 01:23:39 +0000 (18:23 -0700)
committerisaacs <i@izs.me>
Mon, 1 Apr 2013 17:53:49 +0000 (10:53 -0700)
commit164d5b3465571a88da59cdddc03bb869126548eb
tree635162efbc4091335f317a1e7e746613573f282b
parent440dcae98744954d1528506f2648aff71aadde25
tls: Destroy socket when encrypted side closes

The v0.8 Stream.pipe() method automatically destroyed the destination
stream whenever the src stream closed.  However, this caused a lot of
problems, and was removed by popular demand.  (Many userland modules
still have a no-op destroy() method just because of this.) It was also
very hazardous because this would be done even if { end: false } was
passed in the pipe options.

In v0.10, we decided that the 'close' event and destroy() method are
application-specific, and pipe() doesn't automatically call destroy().
However, TLS actually depended (silently) on this behavior.  So, in this
case, we should just go ahead and destroy the thing when close happens.

Closes #5145
lib/tls.js