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);
		}

		switch (msg.type) {
			case ProtocolMessageType.None: {
				// N/A
				break;
			}
			case 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);
					}
				}
				break;
			}
			case ProtocolMessageType.Control: {
				this._onControlMessage.fire(msg.data);
				break;
			}
			case ProtocolMessageType.Ack: {
				// nothing to do, .ack is handled above already
				break;
			}
			case ProtocolMessageType.Disconnect: {
				this._onDidDispose.fire();
				break;
			}
			case 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();
				break;
			}
			case ProtocolMessageType.Pause: {
				this._socketWriter.pause();
				break;
			}
			case ProtocolMessageType.Resume: {
				this._socketWriter.resume();
				break;
			}
			case ProtocolMessageType.KeepAlive: {
				// nothing to do
				break;
			}
		}
	}