diff --git a/src/main/ipc-handlers/connection.ts b/src/main/ipc-handlers/connection.ts index d9b2b074..fa87cbeb 100644 --- a/src/main/ipc-handlers/connection.ts +++ b/src/main/ipc-handlers/connection.ts @@ -55,7 +55,7 @@ export default (connections: {[key: string]: antares.Client}) => { port: conn.sshPort ? conn.sshPort : 22, privateKey: conn.sshKey ? fs.readFileSync(conn.sshKey).toString() : null, passphrase: conn.sshPassphrase, - keepaliveInterval: conn.sshKeepAliveInterval ?? conn.sshKeepAliveInterval*1000 + keepaliveInterval: conn.sshKeepAliveInterval ? conn.sshKeepAliveInterval*1000 : null }; } @@ -137,7 +137,7 @@ export default (connections: {[key: string]: antares.Client}) => { port: conn.sshPort ? conn.sshPort : 22, privateKey: conn.sshKey ? fs.readFileSync(conn.sshKey).toString() : null, passphrase: conn.sshPassphrase, - keepaliveInterval: conn.sshKeepAliveInterval ?? conn.sshKeepAliveInterval*1000 + keepaliveInterval: conn.sshKeepAliveInterval ? conn.sshKeepAliveInterval*1000 : null }; } diff --git a/src/main/libs/clients/MySQLClient.ts b/src/main/libs/clients/MySQLClient.ts index 9343aca2..45269206 100644 --- a/src/main/libs/clients/MySQLClient.ts +++ b/src/main/libs/clients/MySQLClient.ts @@ -168,7 +168,10 @@ export class MySQLClient extends BaseClient { dbConfig.port = tunnel.localPort; } catch (err) { - if (this._ssh) this._ssh.close(); + if (this._ssh) { + this._ssh.close(); + this._ssh.closeTunnel(); + } throw err; } } @@ -187,7 +190,10 @@ export class MySQLClient extends BaseClient { this._connection.end(); clearInterval(this._keepaliveTimer); this._keepaliveTimer = undefined; - if (this._ssh) this._ssh.close(); + if (this._ssh) { + this._ssh.close(); + this._ssh.closeTunnel(); + } } async getConnection () { diff --git a/src/main/libs/clients/PostgreSQLClient.ts b/src/main/libs/clients/PostgreSQLClient.ts index d13b425e..7903bf8a 100644 --- a/src/main/libs/clients/PostgreSQLClient.ts +++ b/src/main/libs/clients/PostgreSQLClient.ts @@ -180,7 +180,10 @@ export class PostgreSQLClient extends BaseClient { dbConfig.port = tunnel.localPort; } catch (err) { - if (this._ssh) this._ssh.close(); + if (this._ssh) { + this._ssh.close(); + this._ssh.closeTunnel(); + } throw err; } } @@ -236,7 +239,10 @@ export class PostgreSQLClient extends BaseClient { this._connection.end(); clearInterval(this._keepaliveTimer); this._keepaliveTimer = undefined; - if (this._ssh) this._ssh.close(); + if (this._ssh) { + this._ssh.close(); + this._ssh.closeTunnel(); + } } private async keepAlive () {