tls: more accurate wrapping of connecting socket
authorFedor Indutny <fedor.indutny@gmail.com>
Tue, 5 Nov 2013 14:14:28 +0000 (18:14 +0400)
committerFedor Indutny <fedor.indutny@gmail.com>
Tue, 5 Nov 2013 14:14:28 +0000 (18:14 +0400)
commita6ddfe20d2bc256c71551b932a353d1b6491efd1
tree9b4e413a93abf1e683d889a476cf70229d143617
parent515607a740222f9a9d25009b739bcd572720b793
tls: more accurate wrapping of connecting socket

When socket, passed in `tls.connect()` `options` argument is not yet
connected to the server, `_handle` gets assigned to a `net.Socket`,
instead of `TLSSocket`.

When socket is connecting to the remote server (i.e. not yet connected,
but already past dns resolve phase), derive `_connecting` property from
it, because otherwise `afterConnect()` will throw an assertion.

fix #6443
lib/_tls_wrap.js
test/simple/test-tls-connect-given-socket.js