joyent/node — pull request #6091 by indutny (2013-08-21 12:01:30+00:00)
Title: tls: fix assertion when ssl is destroyed at read 

`maybeInitFinished()` might invoke `secure` event which, in turn,
could lead to the destruction of connection. If such condition
appeared after non-empty read - loop will continue and `clearOut`
will be called on `null` object instead of `crypto::Connection`
instance. In the result, following assertion was thrown:

ERROR: Error: Hostname/IP doesn't match certificate's altnames
Assertion failed: handle->InternalFieldCount() > 0

fix #5756

/cc @bnoordhuis