mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 01:26:01 +00:00
SSH - handle SSH error
This commit is contained in:
@@ -43,19 +43,25 @@ function callForwardProcess(connection, tunnelConfig, tunnelCacheKey) {
|
|||||||
logger.error(extractErrorLogData(err), 'Error connecting SSH');
|
logger.error(extractErrorLogData(err), 'Error connecting SSH');
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
let promiseHandled = false;
|
||||||
subprocess.on('message', resp => {
|
subprocess.on('message', resp => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const { msgtype, errorMessage } = resp;
|
const { msgtype, errorMessage } = resp;
|
||||||
if (msgtype == 'connected') {
|
if (msgtype == 'connected') {
|
||||||
resolve(subprocess);
|
resolve(subprocess);
|
||||||
|
promiseHandled = true;
|
||||||
}
|
}
|
||||||
if (msgtype == 'error') {
|
if (msgtype == 'error') {
|
||||||
reject(new Error(errorMessage));
|
reject(new Error(errorMessage));
|
||||||
|
promiseHandled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
subprocess.on('exit', code => {
|
subprocess.on('exit', code => {
|
||||||
logger.info('SSH forward process exited');
|
logger.info('SSH forward process exited');
|
||||||
delete sshTunnelCache[tunnelCacheKey];
|
delete sshTunnelCache[tunnelCacheKey];
|
||||||
|
if (!promiseHandled) {
|
||||||
|
reject(new Error('SSH forward process exited, try to change "Local host address for SSH connections" in Settings/Connections'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ ORDER BY
|
|||||||
{ value: '127.0.0.1', label: '127.0.0.1 (IPv4)' },
|
{ value: '127.0.0.1', label: '127.0.0.1 (IPv4)' },
|
||||||
{ value: '::1', label: '::1 (IPv6)' },
|
{ value: '::1', label: '::1 (IPv6)' },
|
||||||
{ value: 'localhost', label: 'localhost (domain name)' },
|
{ value: 'localhost', label: 'localhost (domain name)' },
|
||||||
{ value: 'testerror', label: 'testerror' },
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user