diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-01-21 14:54:01 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-01-23 16:32:20 +0100 |
commit | 2b65399694440d0bab1c4e394898a4555e58c324 (patch) | |
tree | 8843314b2b38788a36b60b48454cee370927a0a2 /lib/internal | |
parent | d3806f9f3cded6bce9831f5d8ff88372ba7e5861 (diff) | |
download | android-node-v8-2b65399694440d0bab1c4e394898a4555e58c324.tar.gz android-node-v8-2b65399694440d0bab1c4e394898a4555e58c324.tar.bz2 android-node-v8-2b65399694440d0bab1c4e394898a4555e58c324.zip |
http2: allow fully synchronous `_final()`
HTTP/2 streams do not use the fact that the native
`StreamBase::Shutdown()` is asynchronous by default and
always finish synchronously.
Adding a status code for this scenario allows skipping an
expensive `MakeCallback()` C++/JS boundary crossing.
PR-URL: https://github.com/nodejs/node/pull/25609
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/http2/core.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 400db84b56..fc99b50eae 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1821,7 +1821,9 @@ class Http2Stream extends Duplex { req.oncomplete = afterShutdown; req.callback = cb; req.handle = handle; - handle.shutdown(req); + const err = handle.shutdown(req); + if (err === 1) // synchronous finish + return afterShutdown.call(req, 0); } else { cb(); } |