Skip to content

Commit 909e78e

Browse files
committed
squash: use setInterval instead of chaining setTimeouts
1 parent 151d2ac commit 909e78e

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

test/parallel/test-dgram-exclusive-implicit-bind.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ if (cluster.isMaster) {
8484
}
8585

8686
const source = dgram.createSocket('udp4');
87-
var timer;
87+
var interval;
8888

8989
source.on('close', function() {
90-
clearTimeout(timer);
90+
clearTimeout(interval);
9191
});
9292

9393
if (process.env.BOUND === 'y') {
@@ -99,12 +99,7 @@ if (process.env.BOUND === 'y') {
9999
source.unref();
100100
}
101101

102-
function send() {
103-
const buf = Buffer.from(process.pid.toString());
104-
timer = setTimeout(function() {
105-
source.send(buf, common.PORT, '127.0.0.1', send);
106-
}, 1);
107-
timer.unref();
108-
}
109-
110-
send();
102+
const buf = Buffer.from(process.pid.toString());
103+
interval = setInterval(() => {
104+
source.send(buf, common.PORT, '127.0.0.1');
105+
}, 1).unref();

0 commit comments

Comments
 (0)