From dcd7b544916f9a90a7509296dd8c6a0d9df3febb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rau=CC=81l=20Montes?= Date: Wed, 30 Aug 2017 18:34:53 -0300 Subject: [PATCH] [fix] Undeterministic error in polling buffer processing --- lib/transports/polling.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/transports/polling.js b/lib/transports/polling.js index 5d15c0763..c7d015eb1 100644 --- a/lib/transports/polling.js +++ b/lib/transports/polling.js @@ -140,11 +140,10 @@ Polling.prototype.onDataRequest = function (req, res) { var self = this; function cleanup () { - chunks = isBinary ? new Buffer(0) : ''; req.removeListener('data', onData); req.removeListener('end', onEnd); req.removeListener('close', onClose); - self.dataReq = self.dataRes = null; + self.dataReq = self.dataRes = chunks = null; } function onClose () { @@ -163,7 +162,7 @@ Polling.prototype.onDataRequest = function (req, res) { } if (contentLength > self.maxHttpBufferSize) { - chunks = ''; + chunks = isBinary ? new Buffer(0) : ''; req.connection.destroy(); } }