src/vs/base/parts/ipc/common/ipc.net.ts/PersistentProtocol/_receiveMessage
class PersistentProtocol:	private _receiveMessage(msg: ProtocolMessage): void {
		if (msg.ack > this._outgoingAckId) {
			this._outgoingAckId = msg.ack;
			do {
				const first = this._outgoingUnackMsg.peek();
				if (first && first.id <= msg.ack) {
					// this message has been confirmed, remove it
					this._outgoingUnackMsg.pop();
				} else {
					break;
				}
			} while (true);
		}

		if (msg.type === ProtocolMessageType.Regular) {
			if (msg.id > this._incomingMsgId) {
				if (msg.id !== this._incomingMsgId + 1) {
					// in case we missed some messages we ask the other party to resend them
					const now = Date.now();
					if (now - this._lastReplayRequestTime > 10000) {
						// send a replay request at most once every 10s
						this._lastReplayRequestTime = now;
						this._socketWriter.write(new ProtocolMessage(ProtocolMessageType.ReplayRequest, 0, 0, getEmptyBuffer()));
					}
				} else {
					this._incomingMsgId = msg.id;
					this._incomingMsgLastTime = Date.now();
					this._sendAckCheck();
					this._onMessage.fire(msg.data);
				}
			}
		} else if (msg.type === ProtocolMessageType.Control) {
			this._onControlMessage.fire(msg.data);
		} else if (msg.type === ProtocolMessageType.Disconnect) {
			this._onDidDispose.fire();
		} else if (msg.type === ProtocolMessageType.ReplayRequest) {
			// Send again all unacknowledged messages
			const toSend = this._outgoingUnackMsg.toArray();
			for (let i = 0, len = toSend.length; i < len; i++) {
				this._socketWriter.write(toSend[i]);
			}
			this._recvAckCheck();
		}
	}