net: wrap connect in nextTick
authorEvan Lucas <evanlucas@me.com>
Thu, 25 Jun 2015 11:41:10 +0000 (06:41 -0500)
committerEvan Lucas <evanlucas@me.com>
Wed, 1 Jul 2015 04:16:26 +0000 (23:16 -0500)
commitaf249fa8a15bad8996187e73b480b30dcd881bad
tree843fbf2341249e3066789c1081b971ac1c44c0a4
parent9180140231823f8a9cd6c6d7cf05d809d76299f2
net: wrap connect in nextTick

Fixes an edge case regression introduced in
1bef71747678c19c7214048de5b9e3848889248d.

With the lookup being skipped, an error could be emitted before an
error listener has been added.

An example of this was presented by changing the server’s IP address
and then immediately making a request to the old address.

Related: https://github.com/nodejs/io.js/pull/1823
PR-URL: https://github.com/nodejs/io.js/pull/2054
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
lib/net.js