summaryrefslogtreecommitdiff
path: root/kvmd/web/js/session.js
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/web/js/session.js')
-rw-r--r--kvmd/web/js/session.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/kvmd/web/js/session.js b/kvmd/web/js/session.js
index c46d228e..b4642b62 100644
--- a/kvmd/web/js/session.js
+++ b/kvmd/web/js/session.js
@@ -32,8 +32,11 @@ var session = new function() {
var __wsErrorHandler = function(event) {
tools.error("WebSocket error:", event);
- __ws.close();
- __ws = null;
+ if (__ws) {
+ __ws.onclose = null;
+ __ws.close();
+ __wsCloseHandler(null);
+ }
};
var __wsCloseHandler = function(event) {
@@ -44,6 +47,7 @@ var session = new function() {
}
hid.clearCapture();
atx.clearLeds();
+ __ws = null;
setTimeout(session.startPoller, 1000);
};
@@ -57,8 +61,9 @@ var session = new function() {
} catch (err) {
tools.error("Ping error:", err.message);
if (__ws) {
+ __ws.onclose = null;
__ws.close();
- __ws = null;
+ __wsCloseHandler(null);
}
}
};