1
1
'use strict' ;
2
- var common = require ( '../common' ) ,
3
- assert = require ( 'assert' ) ,
4
- dgram = require ( 'dgram' ) ,
5
- util = require ( 'util' ) ,
6
- networkInterfaces = require ( 'os' ) . networkInterfaces ( ) ,
7
- Buffer = require ( 'buffer' ) . Buffer ,
8
- fork = require ( 'child_process' ) . fork ,
9
- LOCAL_BROADCAST_HOST = '255.255.255.255' ,
10
- TIMEOUT = common . platformTimeout ( 5000 ) ,
11
- messages = [
12
- new Buffer ( 'First message to send' ) ,
13
- new Buffer ( 'Second message to send' ) ,
14
- new Buffer ( 'Third message to send' ) ,
15
- new Buffer ( 'Fourth message to send' )
16
- ] ;
2
+ const common = require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+ const dgram = require ( 'dgram' ) ;
5
+ const util = require ( 'util' ) ;
6
+ const networkInterfaces = require ( 'os' ) . networkInterfaces ( ) ;
7
+ const Buffer = require ( 'buffer' ) . Buffer ;
8
+ const fork = require ( 'child_process' ) . fork ;
9
+ const LOCAL_BROADCAST_HOST = '255.255.255.255' ;
10
+ const TIMEOUT = common . platformTimeout ( 5000 ) ;
11
+ const messages = [
12
+ new Buffer ( 'First message to send' ) ,
13
+ new Buffer ( 'Second message to send' ) ,
14
+ new Buffer ( 'Third message to send' ) ,
15
+ new Buffer ( 'Fourth message to send' )
16
+ ] ;
17
17
18
18
if ( common . inFreeBSDJail ) {
19
19
console . log ( '1..0 # Skipped: in a FreeBSD jail' ) ;
@@ -34,13 +34,13 @@ get_bindAddress: for (var name in networkInterfaces) {
34
34
assert . ok ( bindAddress ) ;
35
35
36
36
if ( process . argv [ 2 ] !== 'child' ) {
37
- var workers = { } ,
38
- listeners = 3 ,
39
- listening = 0 ,
40
- dead = 0 ,
41
- i = 0 ,
42
- done = 0 ,
43
- timer = null ;
37
+ const workers = { } ;
38
+ const listeners = 3 ;
39
+ let listening = 0 ;
40
+ let dead = 0 ;
41
+ let i = 0 ;
42
+ let done = 0 ;
43
+ let timer = null ;
44
44
45
45
//exit the test if it doesn't succeed within TIMEOUT
46
46
timer = setTimeout ( function ( ) {
@@ -166,15 +166,21 @@ if (process.argv[2] !== 'child') {
166
166
return ;
167
167
}
168
168
169
- sendSocket . send ( buf , 0 , buf . length ,
170
- common . PORT , LOCAL_BROADCAST_HOST , function ( err ) {
171
- if ( err ) throw err ;
172
- console . error ( '[PARENT] sent %s to %s:%s' ,
173
- util . inspect ( buf . toString ( ) ) ,
174
- LOCAL_BROADCAST_HOST , common . PORT ) ;
175
-
176
- process . nextTick ( sendSocket . sendNext ) ;
177
- } ) ;
169
+ sendSocket . send (
170
+ buf ,
171
+ 0 ,
172
+ buf . length ,
173
+ common . PORT ,
174
+ LOCAL_BROADCAST_HOST ,
175
+ function ( err ) {
176
+ if ( err ) throw err ;
177
+ console . error ( '[PARENT] sent %s to %s:%s' ,
178
+ util . inspect ( buf . toString ( ) ) ,
179
+ LOCAL_BROADCAST_HOST , common . PORT ) ;
180
+
181
+ process . nextTick ( sendSocket . sendNext ) ;
182
+ }
183
+ ) ;
178
184
} ;
179
185
180
186
function killChildren ( children ) {
0 commit comments