From a44fcb8e7f81cfdd819834e19d7440af881d0b89 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 18 Jul 2018 16:53:32 +0200 Subject: [PATCH] set header size to its actual size, skip assertion when writing, #54570 --- src/vs/base/parts/ipc/node/ipc.net.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/base/parts/ipc/node/ipc.net.ts b/src/vs/base/parts/ipc/node/ipc.net.ts index 0be4208d0e9..a28e7ab81b5 100644 --- a/src/vs/base/parts/ipc/node/ipc.net.ts +++ b/src/vs/base/parts/ipc/node/ipc.net.ts @@ -25,7 +25,7 @@ export function generateRandomPipeName(): string { export class Protocol implements IMessagePassingProtocol { - private static readonly _headerLen = 17; + private static readonly _headerLen = 5; private _onMessage = new Emitter(); @@ -50,7 +50,7 @@ export class Protocol implements IMessagePassingProtocol { while (totalLength > 0) { if (state.readHead) { - // expecting header -> read 17bytes for header + // expecting header -> read 5bytes for header // information: `bodyIsJson` and `bodyLen` if (totalLength >= Protocol._headerLen) { const all = Buffer.concat(chunks); @@ -123,10 +123,10 @@ export class Protocol implements IMessagePassingProtocol { // ensure string if (typeof message !== 'string') { message = JSON.stringify(message); - header.writeInt8(1, 0); + header.writeInt8(1, 0, true); } const data = Buffer.from(message); - header.writeInt32BE(data.length, 1); + header.writeInt32BE(data.length, 1, true); this._writeSoon(header, data); } -- GitLab