Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib: simplify flushing mechanism #23186

Closed
wants to merge 1 commit into from
Closed

Commits on Oct 7, 2018

  1. zlib: simplify flushing mechanism

    Previously, flushing on zlib streams was implemented through
    stream 'drain' handlers. This has a number of downsides; in
    particular, it is complex, and could lead to unpredictable
    behaviour, since it meant that in a sequence like
    
    ```js
    compressor.write('abc');
    compressor.flush();
    waitForMoreDataAsynchronously(() => {
      compressor.write('def');
    });
    ```
    
    it was not fully deterministic whether the flush happens after
    the second chunk is written or the first one.
    
    This commit replaces this mechanism by one that piggy-backs
    along the stream’s write queue, using a “special” `Buffer`
    instance that signals that a flush is currently due.
    addaleax committed Oct 7, 2018
    Configuration menu
    Copy the full SHA
    51b34e8 View commit details
    Browse the repository at this point in the history