◐ Shell
clean mode source ↗

test: resolve race condition in test-net-write-fully-async-* · nodejs/node@20c032e

Original file line numberDiff line numberDiff line change

@@ -11,14 +11,14 @@ const data = Buffer.alloc(1000000);

1111
1212

const server = net.createServer(common.mustCall(function(conn) {

1313

conn.resume();

14+

server.close();

1415

})).listen(0, common.mustCall(function() {

1516

const conn = net.createConnection(this.address().port, common.mustCall(() => {

1617

let count = 0;

1718
1819

function writeLoop() {

19-

if (count++ === 200) {

20-

conn.destroy();

21-

server.close();

20+

if (count++ === 20) {

21+

conn.end();

2222

return;

2323

}

2424
Original file line numberDiff line numberDiff line change

@@ -9,14 +9,14 @@ const data = Buffer.alloc(1000000).toString('hex');

99
1010

const server = net.createServer(common.mustCall(function(conn) {

1111

conn.resume();

12+

server.close();

1213

})).listen(0, common.mustCall(function() {

1314

const conn = net.createConnection(this.address().port, common.mustCall(() => {

1415

let count = 0;

1516
1617

function writeLoop() {

1718

if (count++ === 20) {

18-

conn.destroy();

19-

server.close();

19+

conn.end();

2020

return;

2121

}

2222