Skip to content

zlib: do not coalesce multiple `.flush()` calls

Rodrigo Muino Tomonari requested to merge github/fork/addaleax/zlib-flush into master

This is an approach to address the issue linked below. Previously, when .write() and .flush() calls to a zlib stream were interleaved synchronously (i.e. without waiting for these operations to finish), multiple flush calls would have been coalesced into a single flushing operation.

This patch changes behaviour so that each .flush() all corresponds to one flushing operation on the underlying zlib resource, and the order of operations is as if the .flush() call were a .write() call.

One test had to be removed because it specifically tested the previous behaviour.

As a drive-by fix, this also makes sure that all flush callbacks are called. Previously, that was not the case.

/cc @mscdex – is this something you prefer over the current behaviour?

Fixes: https://github.com/nodejs/node/issues/28478

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading