From 52aab47766ac2b8a9667f15a2f58b98c9bab9018 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sat, 8 Jun 2019 00:23:18 +0200 Subject: [PATCH] http2: remove unnecessary bind from setImmediate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/28131 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen Reviewed-By: Ruben Bridgewater --- lib/internal/http2/core.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 36e36ec940975f..abd9c8f417b81b 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2152,12 +2152,16 @@ class Http2Stream extends Duplex { // By using setImmediate we allow pushStreams to make it through // before the stream is officially closed. This prevents a bug // in most browsers where those pushStreams would be rejected. - setImmediate(this.close.bind(this)); + setImmediate(callStreamClose, this); } } } } +function callStreamClose(stream) { + stream.close(); +} + function processHeaders(oldHeaders) { assertIsObject(oldHeaders, 'headers'); const headers = ObjectCreate(null);