From 805271afe930d0cc28adc4a30c7173dade52de7b Mon Sep 17 00:00:00 2001 From: "awei.yu" <328080339@qq.com> Date: Mon, 27 Dec 2021 17:26:17 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=EF=BC=9A?= =?UTF-8?q?=E5=85=88=E5=85=B3=E9=97=AD=E8=B0=83=E8=AF=95=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=86=8D=E5=85=B3=E9=97=AD=E9=A1=B5=E9=9D=A2=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E5=88=97=E8=A1=A8=E4=B8=8D=E4=BC=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=AF=A5=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/websocket/Channel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/websocket/Channel.js b/server/websocket/Channel.js index a224ac5..02d274d 100644 --- a/server/websocket/Channel.js +++ b/server/websocket/Channel.js @@ -29,7 +29,10 @@ module.exports = class Channel extends EventEmitter { const onClose = (...args) => { this.status = STATUS_CLOSED; this.emit('close', ...args); - this.destroy(); + // 当被调试页面 socket 断开时(而不是调试工具断开时),销毁相关连接 + if (this._name === 'backend') { + this.destroy(); + } ws.off('close', onClose); ws.off('message', onMessage); debug(`${getColorfulName(this._ws.role)} ${this._ws.id} Closed, errno:${args[0]}`);