Skip to content

Commit be88f7c

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

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/internal/http2/core.js

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

0 commit comments

Comments
 (0)