Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ Zlib.prototype.flush = function(kind, callback) {
this.once('end', callback);
} else if (ws.needDrain) {
var self = this;
this.once('drain', function() {
self.flush(callback);
});
if (callback) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to add this check, might as well make it a check for a function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

this.once('drain', function() {
self.flush(callback);
});
}
} else {
this._flushFlag = kind;
this.write(new Buffer(0), '', callback);
Expand Down