Skip to content

Commit 20c032e

Browse files
mcollinaaduh95
authored andcommitted
test: resolve race condition in test-net-write-fully-async-*
Signed-off-by: Matteo Collina <[email protected]> PR-URL: #57022 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 3d103ec commit 20c032e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎test/parallel/test-net-write-fully-async-buffer.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ const data = Buffer.alloc(1000000);
1111

1212
constserver=net.createServer(common.mustCall(function(conn){
1313
conn.resume();
14+
server.close();
1415
})).listen(0,common.mustCall(function(){
1516
constconn=net.createConnection(this.address().port,common.mustCall(()=>{
1617
letcount=0;
1718

1819
functionwriteLoop(){
19-
if(count++===200){
20-
conn.destroy();
21-
server.close();
20+
if(count++===20){
21+
conn.end();
2222
return;
2323
}
2424

‎test/parallel/test-net-write-fully-async-hex-string.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ const data = Buffer.alloc(1000000).toString('hex');
99

1010
constserver=net.createServer(common.mustCall(function(conn){
1111
conn.resume();
12+
server.close();
1213
})).listen(0,common.mustCall(function(){
1314
constconn=net.createConnection(this.address().port,common.mustCall(()=>{
1415
letcount=0;
1516

1617
functionwriteLoop(){
1718
if(count++===20){
18-
conn.destroy();
19-
server.close();
19+
conn.end();
2020
return;
2121
}
2222

0 commit comments

Comments
(0)