Skip to content

Commit b570e18

Browse files
pimterryaduh95
authored andcommitted
test: fix flaky cleanup in http2 test
Signed-off-by: Tim Perry <pimterry@gmail.com> PR-URL: #65701 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 8c90fa8 commit b570e18

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/parallel/test-http2-bidirectional-write-deadlock.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class StalledClientSocket extends Duplex {
3838
super();
3939
this.inner = net.connect(port, common.localhostIPv4);
4040
this.inner.on('data', (chunk) => this.push(chunk));
41+
this.inner.on('end', () => this.push(null));
4142
}
4243
_read() {
4344
// Incoming data is pushed as it arrives.
@@ -54,7 +55,7 @@ class StalledClientSocket extends Duplex {
5455
callback();
5556
}
5657
_final(callback) {
57-
callback();
58+
this.inner.end(callback);
5859
}
5960
_destroy(err, callback) {
6061
this.inner.destroy();
@@ -101,7 +102,8 @@ server.listen(0, common.mustCall(() => {
101102
stallWrites = false;
102103
for (const callback of heldCallbacks) callback();
103104

104-
client.destroy();
105+
req.end();
106+
client.close();
105107
server.close();
106108
}));
107109
}));

0 commit comments

Comments
 (0)