mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
lib: simplify 'processChunkSync'
According to the real logic codes, it seems no matter whether 'nread >= kMaxLength' or not. We always close the 'self' stream first. So we can shorten it by merging them into one sample. PR-URL: https://github.com/nodejs/node/pull/22802 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com>
This commit is contained in:
1 parent
f0a40172a8
commit
49b59334d0
1 file changed
+1
-3
+1
-3
@@ -527,14 +527,12 @@ function processChunkSync(self, chunk, flushFlag) {
|
||||
}
|
||||
|
||||
self.bytesWritten = inputRead;
|
||||
_close(self);
|
||||
|
||||
if (nread >= kMaxLength) {
|
||||
_close(self);
|
||||
throw new ERR_BUFFER_TOO_LARGE();
|
||||
}
|
||||
|
||||
_close(self);
|
||||
|
||||
if (nread === 0)
|
||||
return Buffer.alloc(0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user