diff options
author | Evan Lucas <evanlucas@me.com> | 2015-04-22 16:46:21 -0500 |
---|---|---|
committer | Evan Lucas <evanlucas@me.com> | 2015-04-24 07:51:24 -0500 |
commit | 1bef71747678c19c7214048de5b9e3848889248d (patch) | |
tree | f5d94bd1fd01b0f012a30e6037c7d58b811970e3 /test/parallel/test-net-dns-lookup-skip.js | |
parent | 3d3083b91f02ca14acddde97612cec98e97ffe38 (diff) | |
download | android-node-v8-1bef71747678c19c7214048de5b9e3848889248d.tar.gz android-node-v8-1bef71747678c19c7214048de5b9e3848889248d.tar.bz2 android-node-v8-1bef71747678c19c7214048de5b9e3848889248d.zip |
net: cleanup connect logic
Separates out the lookup logic for net.Socket. In the event
the `host` property is an IP address, the lookup is skipped.
PR-URL: https://github.com/iojs/io.js/pull/1505
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Diffstat (limited to 'test/parallel/test-net-dns-lookup-skip.js')
-rw-r--r-- | test/parallel/test-net-dns-lookup-skip.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/parallel/test-net-dns-lookup-skip.js b/test/parallel/test-net-dns-lookup-skip.js new file mode 100644 index 0000000000..7a129b9795 --- /dev/null +++ b/test/parallel/test-net-dns-lookup-skip.js @@ -0,0 +1,18 @@ +var common = require('../common'); +var assert = require('assert'); +var net = require('net'); + +function check(addressType) { + var server = net.createServer(function(client) { + client.end(); + server.close(); + }); + + var address = addressType === 4 ? '127.0.0.1' : '::1'; + server.listen(common.PORT, address, function() { + net.connect(common.PORT, address).on('lookup', assert.fail); + }); +} + +check(4); +common.hasIPv6 && check(6); |