From 4994d5789011c1f382bccbcec143b2c972f461e0 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 26 Nov 2017 11:50:59 -0800 Subject: [PATCH] http2: remove unnecessary event handlers PR-URL: https://github.com/nodejs/node/pull/17328 Fixes: https://github.com/nodejs/node/issues/15303 Reviewed-By: Anatoli Papirovski Reviewed-By: Sebastiaan Deckers --- lib/internal/http2/compat.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 5ddde39d387785..ec1f0ba64eff0a 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -122,20 +122,6 @@ function onStreamDrain() { response.emit('drain'); } -// TODO Http2Stream does not emit 'close' -function onStreamClosedRequest() { - const request = this[kRequest]; - if (request !== undefined) - request.push(null); -} - -// TODO Http2Stream does not emit 'close' -function onStreamClosedResponse() { - const response = this[kResponse]; - if (response !== undefined) - response.emit('finish'); -} - function onStreamAbortedRequest() { const request = this[kRequest]; if (request !== undefined && request[kState].closed === false) { @@ -247,7 +233,6 @@ class Http2ServerRequest extends Readable { stream.on('trailers', onStreamTrailers); stream.on('end', onStreamEnd); stream.on('error', onStreamError); - stream.on('close', onStreamClosedRequest); stream.on('aborted', onStreamAbortedRequest); const onfinish = this[kFinish].bind(this); stream.on('close', onfinish); @@ -380,7 +365,6 @@ class Http2ServerResponse extends Stream { stream[kResponse] = this; this.writable = true; stream.on('drain', onStreamDrain); - stream.on('close', onStreamClosedResponse); stream.on('aborted', onStreamAbortedResponse); const onfinish = this[kFinish].bind(this); stream.on('close', onfinish);