Limited retries to reset consoles after reboot or halt or whatever disconnects...
This commit is contained in:
19
app/node_modules/angular-no-vnc/index.js
generated
vendored
19
app/node_modules/angular-no-vnc/index.js
generated
vendored
@@ -41,7 +41,15 @@ export default angular.module('no-vnc', [])
|
||||
this.width = width
|
||||
})
|
||||
|
||||
const retrySteps = {
|
||||
0: 1000,
|
||||
1: 3000,
|
||||
2: 5000,
|
||||
3: 5000
|
||||
}
|
||||
let retryStep = 0
|
||||
let rfb
|
||||
let reconnectTry
|
||||
function clean () {
|
||||
// If there was a previous connection.
|
||||
if (rfb) {
|
||||
@@ -73,10 +81,19 @@ export default angular.module('no-vnc', [])
|
||||
})
|
||||
|
||||
rfb._onUpdateState = (rfb, state) => {
|
||||
if (state === 'normal') {
|
||||
retryStep = 0
|
||||
if (reconnectTry) {
|
||||
$timeout.cancel(reconnectTry)
|
||||
reconnectTry = undefined
|
||||
}
|
||||
}
|
||||
if (state !== 'disconnected') {
|
||||
return
|
||||
}
|
||||
$timeout(() => reset(url), 1000)
|
||||
if (retryStep in retrySteps) {
|
||||
reconnectTry = $timeout(() => reset(url), retrySteps[retryStep++])
|
||||
}
|
||||
}
|
||||
|
||||
// Connect.
|
||||
|
||||
Reference in New Issue
Block a user