Added a canceled message and increased reconnect interval
This commit is contained in:
parent
3663adfe4f
commit
6daf7f0716
1 changed files with 5 additions and 3 deletions
|
@ -80,6 +80,7 @@ class TSClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
startConnection(addr: string, profile: profiles.ConnectionProfile, name?: string, password?: {password: string, hashed: boolean}) {
|
startConnection(addr: string, profile: profiles.ConnectionProfile, name?: string, password?: {password: string, hashed: boolean}) {
|
||||||
|
this.cancel_reconnect();
|
||||||
this._reconnect_attempt = false;
|
this._reconnect_attempt = false;
|
||||||
if(this.serverConnection)
|
if(this.serverConnection)
|
||||||
this.handleDisconnect(DisconnectReason.REQUESTED);
|
this.handleDisconnect(DisconnectReason.REQUESTED);
|
||||||
|
@ -277,9 +278,9 @@ class TSClient {
|
||||||
console.log(tr("Allowed to auto reconnect but cant reconnect because we dont have any information left..."));
|
console.log(tr("Allowed to auto reconnect but cant reconnect because we dont have any information left..."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chat.serverChat().appendMessage(tr("Reconnecting in 2.5 seconds"));
|
chat.serverChat().appendMessage(tr("Reconnecting in 5 seconds"));
|
||||||
|
|
||||||
console.log(tr("Allowed to auto reconnect. Reconnecting in 2500ms"));
|
console.log(tr("Allowed to auto reconnect. Reconnecting in 5000ms"));
|
||||||
const server_address = this.serverConnection._remote_address;
|
const server_address = this.serverConnection._remote_address;
|
||||||
const profile = this.serverConnection._handshakeHandler.profile;
|
const profile = this.serverConnection._handshakeHandler.profile;
|
||||||
const name = this.serverConnection._handshakeHandler.name;
|
const name = this.serverConnection._handshakeHandler.name;
|
||||||
|
@ -291,12 +292,13 @@ class TSClient {
|
||||||
console.log(tr("Reconnecting..."));
|
console.log(tr("Reconnecting..."));
|
||||||
this.startConnection(server_address.host + ":" + server_address.port, profile, name, password ? { password: password, hashed: true} : undefined);
|
this.startConnection(server_address.host + ":" + server_address.port, profile, name, password ? { password: password, hashed: true} : undefined);
|
||||||
this._reconnect_attempt = true;
|
this._reconnect_attempt = true;
|
||||||
}, 2500);
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel_reconnect() {
|
cancel_reconnect() {
|
||||||
if(this._reconnect_timer) {
|
if(this._reconnect_timer) {
|
||||||
|
chat.serverChat().appendMessage(tr("Reconnect canceled"));
|
||||||
clearTimeout(this._reconnect_timer);
|
clearTimeout(this._reconnect_timer);
|
||||||
this._reconnect_timer = undefined;
|
this._reconnect_timer = undefined;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue