From 6641cc489d053d6978868b94ddfb3dc93fd96dde Mon Sep 17 00:00:00 2001 From: Lei YU Date: Fri, 18 Jun 2021 19:22:57 +0800 Subject: kvm: Disconnect on page unload/refresh Disconnect the VNC when page is unloaded. Otherwise, it creates a new VNC connection on every page load/refresh, and it causes the KVM failure when it reaches the max connections. Tested: Refresh the KVM page, go to other pages and go back to KVM page, verify the KVM works fine and the connection is closed and re-connected, and verify there is no extra connections. obmc-ikvm[233]: 18/06/2021 10:46:26 Got connection from client 127.0.0.1 obmc-ikvm[233]: 18/06/2021 10:46:26 0 other clients Signed-off-by: Lei YU Change-Id: Iffb3cf34a357e247d4b2aabe8dc17080b50c8da4 --- src/views/Control/Kvm/KvmConsole.vue | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/views') diff --git a/src/views/Control/Kvm/KvmConsole.vue b/src/views/Control/Kvm/KvmConsole.vue index d7ec31e0..c028a9fc 100644 --- a/src/views/Control/Kvm/KvmConsole.vue +++ b/src/views/Control/Kvm/KvmConsole.vue @@ -94,11 +94,16 @@ export default { }, beforeDestroy() { window.removeEventListener('resize', this.resizeKvmWindow); + this.closeTerminal(); }, methods: { sendCtrlAltDel() { this.rfb.sendCtrlAltDel(); }, + closeTerminal() { + this.rfb.disconnect(); + this.rfb = null; + }, openTerminal() { const token = this.$store.getters['authentication/token']; this.rfb = new RFB( -- cgit v1.2.3