From a363ac0781264fce0ac57d9f23b15999edc05463 Mon Sep 17 00:00:00 2001 From: Craig Cavalier Date: Tue, 14 Jul 2015 11:06:48 -0400 Subject: [PATCH] only apply drain listener when callback provided --- lib/zlib.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/zlib.js b/lib/zlib.js index a85e8efb5181..64135ffece45 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -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) { + this.once('drain', function() { + self.flush(callback); + }); + } } else { this._flushFlag = kind; this.write(new Buffer(0), '', callback);