[*] 信令状态

This commit is contained in:
acgist
2023-10-09 09:55:02 +08:00
parent 98c701bc94
commit 5de53dd41e

View File

@@ -137,16 +137,13 @@ const signalChannel = {
*/
async connect(address, reconnection = true) {
const me = this;
// 直接返回旧的连接
if (me.connected()) {
this.taoyao.connect = true;
return new Promise((resolve, reject) => {
resolve(me.channel);
});
}
// 关闭旧的无效连接
if(this.channel) {
console.debug("关闭旧的信令连接", this.address);
this.close();
} else {
this.taoyao.connect = false;
}
me.address = address;
me.reconnection = reconnection;