Skip to content

Commit be88f7c

Browse files
atlowChemiruyadorno
authored andcommittedSep 16, 2023
http2: use addAbortListener
PR-URL: #48550 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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

+3-4
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)
Please sign in to comment.