mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
stream: relocate the status checking code in the onwritecomplete
Some checks failed
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` that lacks metadata (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Find inactive TSC voting members / find (push) Has been cancelled
Some checks failed
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` that lacks metadata (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Find inactive TSC voting members / find (push) Has been cancelled
relocate the status checking code before verifying if the stream is destroyed PR-URL: https://github.com/nodejs/node/pull/54032 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
294ae14b98
commit
298dea0c63
@ -83,23 +83,21 @@ function onWriteComplete(status) {
|
||||
|
||||
const stream = this.handle[owner_symbol];
|
||||
|
||||
if (status < 0) {
|
||||
const error = new ErrnoException(status, 'write', this.error);
|
||||
if (typeof this.callback === 'function') {
|
||||
return this.callback(error);
|
||||
}
|
||||
|
||||
return stream.destroy(error);
|
||||
}
|
||||
|
||||
if (stream.destroyed) {
|
||||
if (typeof this.callback === 'function')
|
||||
this.callback(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO (ronag): This should be moved before if(stream.destroyed)
|
||||
// in order to avoid swallowing error.
|
||||
if (status < 0) {
|
||||
const ex = new ErrnoException(status, 'write', this.error);
|
||||
if (typeof this.callback === 'function')
|
||||
this.callback(ex);
|
||||
else
|
||||
stream.destroy(ex);
|
||||
return;
|
||||
}
|
||||
|
||||
stream[kUpdateTimer]();
|
||||
stream[kAfterAsyncWrite](this);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user