0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

stream: prevent object map change in ReadableState

ReadableState has the resumeScheduled property that helps determine if
a stream should be resumed. It was not assigned in the constructor.
When stream.resume is called on a readable stream that is not flowing,
it is set to true. This changes the property map of the ReadableState
which can cause a deopt in onEofChunk and needMoreData.

PR-URL: https://github.com/nodejs/node/pull/4761
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
This commit is contained in:
Evan Lucas 2016-01-19 08:53:38 -06:00
parent 647861befb
commit df4d209ad5

View File

@ -51,6 +51,7 @@ function ReadableState(options, stream) {
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
// Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.