Skip to content

Commit e4333ac

Browse files
atlowChemijuanarbol
authored andcommitted
http2: use addAbortListener
PR-URL: #48550 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent cc7809d commit e4333ac

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/internal/http2/core.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const {
2727
StringPrototypeSlice,
2828
Symbol,
2929
SymbolAsyncDispose,
30+
SymbolDispose,
3031
TypedArrayPrototypeGetLength,
3132
Uint32Array,
3233
Uint8Array,
@@ -1811,10 +1812,8 @@ class ClientHttp2Session extends Http2Session {
18111812
if (signal.aborted) {
18121813
aborter();
18131814
} else {
1814-
signal.addEventListener('abort', aborter);
1815-
stream.once('close', () => {
1816-
signal.removeEventListener('abort', aborter);
1817-
});
1815+
const disposable = EventEmitter.addAbortListener(signal, aborter);
1816+
stream.once('close', disposable[SymbolDispose]);
18181817
}
18191818
}
18201819

0 commit comments

Comments
 (0)