diff options
author | Rich Trott <rtrott@gmail.com> | 2015-12-23 00:58:14 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2015-12-25 09:28:27 -0800 |
commit | 7d1d0b7aebfbebbb84bbbbf0a4878559ca8f3e24 (patch) | |
tree | ed56816c85cf17d99713c69004839011cb5ed50b /test/parallel/test-net-connect-options-ipv6.js | |
parent | 025e4aaf37da879b7614bc2dbbe2b384ece100af (diff) | |
download | node-new-7d1d0b7aebfbebbb84bbbbf0a4878559ca8f3e24.tar.gz |
test: refactor test-net-connect-options-ipv6
Remove unused variable and refactor checking for event firing.
PR-URL: https://github.com/nodejs/node/pull/4395
Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'test/parallel/test-net-connect-options-ipv6.js')
-rw-r--r-- | test/parallel/test-net-connect-options-ipv6.js | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 623b2eff1d..8b11612a12 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -2,16 +2,12 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -const dns = require('dns'); if (!common.hasIPv6) { console.log('1..0 # Skipped: no IPv6 support'); return; } -var serverGotEnd = false; -var clientGotEnd = false; - const hosts = common.localIPv6Hosts; var hostIdx = 0; var host = hosts[hostIdx]; @@ -19,9 +15,7 @@ var localhostTries = 10; const server = net.createServer({allowHalfOpen: true}, function(socket) { socket.resume(); - socket.on('end', function() { - serverGotEnd = true; - }); + socket.on('end', common.mustCall(function() {})); socket.end(); }); @@ -36,13 +30,12 @@ function tryConnect() { }, function() { console.error('client connect cb'); client.resume(); - client.on('end', function() { - clientGotEnd = true; + client.on('end', common.mustCall(function() { setTimeout(function() { assert(client.writable); client.end(); }, 10); - }); + })); client.on('close', function() { server.close(); }); @@ -54,7 +47,6 @@ function tryConnect() { tryConnect(); else { console.log('1..0 # Skipped: no IPv6 localhost support'); - process.removeListener('exit', onExit); server.close(); } return; @@ -62,10 +54,3 @@ function tryConnect() { throw err; }); } - -process.on('exit', onExit); -function onExit() { - console.error('exit', serverGotEnd, clientGotEnd); - assert(serverGotEnd); - assert(clientGotEnd); -} |