Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cda459e

Browse filesBrowse files
lundibundiaddaleax
authored andcommitted
zlib: replace usage of internal stream state with public api
Refs: #445 PR-URL: #34884 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 481cced commit cda459e
Copy full SHA for cda459e

File tree

Expand file treeCollapse file tree

1 file changed

+3
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-6
lines changed
Open diff view settings
Collapse file

‎lib/zlib.js‎

Copy file name to clipboardExpand all lines: lib/zlib.js
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,15 @@ const kFlushBuffers = [];
349349
}
350350

351351
ZlibBase.prototype.flush = function(kind, callback) {
352-
const ws = this._writableState;
353-
354352
if (typeof kind === 'function' || (kind === undefined && !callback)) {
355353
callback = kind;
356354
kind = this._defaultFullFlushFlag;
357355
}
358356

359-
if (ws.ended) {
357+
if (this.writableFinished) {
360358
if (callback)
361359
process.nextTick(callback);
362-
} else if (ws.ending) {
360+
} else if (this.writableEnded) {
363361
if (callback)
364362
this.once('end', callback);
365363
} else {
@@ -386,8 +384,7 @@ ZlibBase.prototype._transform = function(chunk, encoding, cb) {
386384
}
387385

388386
// For the last chunk, also apply `_finishFlushFlag`.
389-
const ws = this._writableState;
390-
if ((ws.ending || ws.ended) && ws.length === chunk.byteLength) {
387+
if (this.writableEnded && this.writableLength === chunk.byteLength) {
391388
flushFlag = maxFlush(flushFlag, this._finishFlushFlag);
392389
}
393390
processChunk(this, chunk, flushFlag, cb);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.