diff options
author | Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com> | 2015-01-21 15:38:44 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-23 18:09:39 +0100 |
commit | 8de89ec465d8f1e31521e0b888c19b0a3309cd88 (patch) | |
tree | 46f67e8032a4e30b359c3e1addca43f467c6df7e /test/sequential/test-net-server-bind.js | |
parent | 3143d732f6efd82da76e9c53ad192ac14071bf70 (diff) | |
download | android-node-v8-8de89ec465d8f1e31521e0b888c19b0a3309cd88.tar.gz android-node-v8-8de89ec465d8f1e31521e0b888c19b0a3309cd88.tar.bz2 android-node-v8-8de89ec465d8f1e31521e0b888c19b0a3309cd88.zip |
lib: move default address logic to `net._listen2`
When address is not provided to `server.listen()`, `_connectionKey` and
error messages should include actual address and correct family.
PR-URL: https://github.com/iojs/io.js/pull/539
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/sequential/test-net-server-bind.js')
-rw-r--r-- | test/sequential/test-net-server-bind.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/sequential/test-net-server-bind.js b/test/sequential/test-net-server-bind.js index c07261c7e8..3a7cd0e15b 100644 --- a/test/sequential/test-net-server-bind.js +++ b/test/sequential/test-net-server-bind.js @@ -18,12 +18,14 @@ server0.listen(function() { // No callback to listen(), assume we can bind in 100 ms var address1; +var connectionKey1; var server1 = net.createServer(function(socket) { }); server1.listen(common.PORT); setTimeout(function() { address1 = server1.address(); + connectionKey1 = server1._connectionKey; console.log('address1 %j', address1); server1.close(); }, 100); @@ -68,6 +70,15 @@ server4.listen(common.PORT + 3, 127, function() { process.on('exit', function() { assert.ok(address0.port > 100); assert.equal(common.PORT, address1.port); + + var expectedConnectionKey1; + + if (address1.family === 'IPv6') + expectedConnectionKey1 = '6::::' + address1.port; + else + expectedConnectionKey1 = '4:0.0.0.0:' + address1.port; + + assert.equal(connectionKey1, expectedConnectionKey1); assert.equal(common.PORT + 1, address2.port); assert.equal(common.PORT + 2, address3.port); assert.equal(common.PORT + 3, address4.port); |