tls: emit errors on close whilst async action
authorFedor Indutny <fedor@indutny.com>
Thu, 14 May 2015 08:38:18 +0000 (10:38 +0200)
committerFedor Indutny <fedor@indutny.com>
Thu, 4 Jun 2015 21:38:06 +0000 (23:38 +0200)
commit5795e835a1021abdf803e1460501487adbac8d7c
treee2df0d2abb183121175b011a51bd6926fc1e2bdf
parent6d95f4ff923018bb9720888e4ea986cddf0ff5b5
tls: emit errors on close whilst async action

When loading session, OCSP response, SNI, always check that the
`self._handle` is present. If it is not - the socket was closed - and we
should emit the error instead of throwing an uncaught exception.

Fix: https://github.com/joyent/node/issues/8780
Fix: https://github.com/iojs/io.js/issues/1696
PR-URL: https://github.com/nodejs/io.js/pull/1702
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
lib/_tls_wrap.js
test/parallel/test-tls-async-cb-after-socket-end.js [new file with mode: 0644]