22const common = require ( '../common' ) ;
33const assert = require ( 'assert' ) ;
44const net = require ( 'net' ) ;
5- const dns = require ( 'dns' ) ;
65
76if ( ! common . hasIPv6 ) {
87 console . log ( '1..0 # Skipped: no IPv6 support' ) ;
98 return ;
109}
1110
12- var serverGotEnd = false ;
13- var clientGotEnd = false ;
14-
1511const hosts = common . localIPv6Hosts ;
1612var hostIdx = 0 ;
1713var host = hosts [ hostIdx ] ;
1814var localhostTries = 10 ;
1915
2016const server = net . createServer ( { allowHalfOpen : true } , function ( socket ) {
2117 socket . resume ( ) ;
22- socket . on ( 'end' , function ( ) {
23- serverGotEnd = true ;
24- } ) ;
18+ socket . on ( 'end' , common . mustCall ( function ( ) { } ) ) ;
2519 socket . end ( ) ;
2620} ) ;
2721
@@ -36,13 +30,12 @@ function tryConnect() {
3630 } , function ( ) {
3731 console . error ( 'client connect cb' ) ;
3832 client . resume ( ) ;
39- client . on ( 'end' , function ( ) {
40- clientGotEnd = true ;
33+ client . on ( 'end' , common . mustCall ( function ( ) {
4134 setTimeout ( function ( ) {
4235 assert ( client . writable ) ;
4336 client . end ( ) ;
4437 } , 10 ) ;
45- } ) ;
38+ } ) ) ;
4639 client . on ( 'close' , function ( ) {
4740 server . close ( ) ;
4841 } ) ;
@@ -54,18 +47,10 @@ function tryConnect() {
5447 tryConnect ( ) ;
5548 else {
5649 console . log ( '1..0 # Skipped: no IPv6 localhost support' ) ;
57- process . removeListener ( 'exit' , onExit ) ;
5850 server . close ( ) ;
5951 }
6052 return ;
6153 }
6254 throw err ;
6355 } ) ;
6456}
65-
66- process . on ( 'exit' , onExit ) ;
67- function onExit ( ) {
68- console . error ( 'exit' , serverGotEnd , clientGotEnd ) ;
69- assert ( serverGotEnd ) ;
70- assert ( clientGotEnd ) ;
71- }
0 commit comments