| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 21362cc commit 8bbdb12
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,12 @@ const advanced = { | |||
| 61 | 61 | *parseChannelMessages(channel, readData) { | |
| 62 | 62 | if (readData.length === 0) return; | |
| 63 | 63 | ||
| 64 | - ArrayPrototypePush(channel[kMessageBuffer], readData); | ||
| 64 | + if (channel[kMessageBufferSize] && channel[kMessageBuffer][0].length < 4) { | ||
| 65 | + // Message length split into two buffers, so let's concatenate it. | ||
| 66 | + channel[kMessageBuffer][0] = Buffer.concat([channel[kMessageBuffer][0], readData]); | ||
| 67 | + } else { | ||
| 68 | + ArrayPrototypePush(channel[kMessageBuffer], readData); | ||
| 69 | + } | ||
| 65 | 70 | channel[kMessageBufferSize] += readData.length; | |
| 66 | 71 | ||
| 67 | 72 | // Index 0 should always be present because we just pushed data into it. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const child_process = require('child_process'); | ||
| 4 | + | ||
| 5 | + // Regression test for https://github.com/nodejs/node/issues/55834 | ||
| 6 | + const msgLen = 65521; | ||
| 7 | + let cnt = 10; | ||
| 8 | + | ||
| 9 | + if (process.argv[2] === 'child') { | ||
| 10 | + const msg = Buffer.allocUnsafe(msgLen); | ||
| 11 | + (function send() { | ||
| 12 | + if (cnt--) { | ||
| 13 | + process.send(msg, send); | ||
| 14 | + } else { | ||
| 15 | + process.disconnect(); | ||
| 16 | + } | ||
| 17 | + })(); | ||
| 18 | + } else { | ||
| 19 | + const child = child_process.spawn(process.execPath, [__filename, 'child'], { | ||
| 20 | + stdio: ['inherit', 'inherit', 'inherit', 'ipc'], | ||
| 21 | + serialization: 'advanced' | ||
| 22 | + }); | ||
| 23 | + child.on('message', common.mustCall(cnt)); | ||
| 24 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments