Skip to content

Commit

Permalink
http2: use addAbortListener
Browse files Browse the repository at this point in the history
PR-URL: #48550
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
atlowChemi authored and ruyadorno committed Sep 16, 2023
1 parent d9a800e commit be88f7c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/internal/http2/core.js
Expand Up @@ -27,6 +27,7 @@ const {
SafeSet,
StringPrototypeSlice,
Symbol,
SymbolDispose,
TypedArrayPrototypeGetLength,
Uint32Array,
Uint8Array,
Expand Down Expand Up @@ -1810,10 +1811,8 @@ class ClientHttp2Session extends Http2Session {
if (signal.aborted) {
aborter();
} else {
signal.addEventListener('abort', aborter);
stream.once('close', () => {
signal.removeEventListener('abort', aborter);
});
const disposable = EventEmitter.addAbortListener(signal, aborter);
stream.once('close', disposable[SymbolDispose]);
}
}

Expand Down

0 comments on commit be88f7c

Please sign in to comment.