From 3bb57bf0fa1ba9ba7b0b54ed424bcff00d03833d Mon Sep 17 00:00:00 2001 From: Brian White Date: Tue, 3 Jan 2017 18:45:28 -0500 Subject: [PATCH] re-add WriteReq and CorkedRequest constructors --- build/files.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/build/files.js b/build/files.js index ede126a18a..77f7eafadb 100644 --- a/build/files.js +++ b/build/files.js @@ -183,6 +183,30 @@ const headRegexp = /(^module.exports = \w+;?)/m /if \(typeof Symbol === 'function' && Symbol\.hasInstance\) \{/, `if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {` ] + , addConstructors = [ + headRegexp, + `$1\n\nfunction WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; + } + // It seems a linked list but it is not + // there will be only 2 of these for each stream + function CorkedRequest(state) { + this.next = null; + this.entry = null; + this.finish = onCorkedFinish.bind(undefined, this, state); + }\n\n` + ] + , useWriteReq = [ + /state\.lastBufferedRequest = \{.+?\}/g, + `state.lastBufferedRequest = new WriteReq(chunk, encoding, cb)` + ] + , useCorkedRequest = [ + /var corkReq = [\s\S]+?(.+?)\.corkedRequestsFree = corkReq/g, + `$1.corkedRequestsFree = new CorkedRequest($1)` + ] module.exports['_stream_duplex.js'] = [ requireReplacement @@ -261,6 +285,9 @@ module.exports['_stream_writable.js'] = [ , bufferShimFix , bufferStaticMethods , fixInstanceCheck + , addConstructors + , useWriteReq + , useCorkedRequest ] module.exports['internal/streams/BufferList.js'] = [ bufferShimFix