Skip to content

Commit 7f63d38

Browse files
raulmtdarrachequesne
authored andcommittedSep 1, 2017
[fix] Fix undeterministic error in polling buffer processing (#529)
Ensure all assignments for chunks are Buffer when they should, even when onData is supposed to not be called again.
1 parent 3dcc2d5 commit 7f63d38

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎lib/transports/polling.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ Polling.prototype.onDataRequest = function (req, res) {
140140
var self = this;
141141

142142
function cleanup () {
143-
chunks = isBinary ? new Buffer(0) : '';
144143
req.removeListener('data', onData);
145144
req.removeListener('end', onEnd);
146145
req.removeListener('close', onClose);
147-
self.dataReq = self.dataRes = null;
146+
self.dataReq = self.dataRes = chunks = null;
148147
}
149148

150149
function onClose () {
@@ -163,7 +162,7 @@ Polling.prototype.onDataRequest = function (req, res) {
163162
}
164163

165164
if (contentLength > self.maxHttpBufferSize) {
166-
chunks = '';
165+
chunks = isBinary ? new Buffer(0) : '';
167166
req.connection.destroy();
168167
}
169168
}

0 commit comments

Comments
 (0)
Please sign in to comment.