diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-10-08 15:26:44 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-10-10 17:37:57 -0700 |
commit | 624fa4147ab26e93107f4d2db90c21840bc88807 (patch) | |
tree | 472a1e685a09ae199c1ce6fece7c68754324f13e /lib | |
parent | 5133e783ba0fbd93bf3a65e18c450b61c18f55a0 (diff) | |
download | android-node-v8-624fa4147ab26e93107f4d2db90c21840bc88807.tar.gz android-node-v8-624fa4147ab26e93107f4d2db90c21840bc88807.tar.bz2 android-node-v8-624fa4147ab26e93107f4d2db90c21840bc88807.zip |
http2: fix file close error condition at respondWithFd
Closing a FileHandle almost never fails, so it was hard to
notice before that `stream.emit(err)` would not emit an error
event due to the missing event name.
Destroying the stream with the error seems like the right thing
to do in that scenario.
PR-URL: https://github.com/nodejs/node/pull/29884
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/http2/core.js | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 11d677c5f6..95ce8bcdb4 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2152,14 +2152,11 @@ function processHeaders(oldHeaders) { return headers; } -function onFileCloseError(stream, err) { - stream.emit(err); -} function onFileUnpipe() { const stream = this.sink[kOwner]; if (stream.ownsFd) - this.source.close().catch(onFileCloseError.bind(stream)); + this.source.close().catch(stream.destroy.bind(stream)); else this.source.releaseFD(); } |