Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

fix(NddService): fix NddService socket.on('data') for large input #323

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion services/ndd_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ class NddService {
const pipeName = `node-ndb.${process.pid}.sock`;
this._pipe = path.join(pipePrefix, pipeName);
const server = net.createServer(socket => {
const chunks = [];
socket.on('data', async d => {
const runSession = await this._startSession(JSON.parse(d), frontend);
chunks.push(d);
});
socket.on('end', async() => {
const data = Buffer.concat(chunks);
const runSession = await this._startSession(JSON.parse(data), frontend);
socket.write('run');
runSession();
});
Expand Down