Commit dcf1994d authored by Joel Martin's avatar Joel Martin

Don't treat onerror as a close.

The close event will also fire so trying to fail the connection twice
is unhelpful and hiding status information.
parent c3900110
...@@ -234,6 +234,7 @@ function constructor() { ...@@ -234,6 +234,7 @@ function constructor() {
} }
}); });
ws.on('close', function(e) { ws.on('close', function(e) {
Util.Warn("WebSocket on-close event");
var msg = ""; var msg = "";
if (e.code) { if (e.code) {
msg = " (code: " + e.code; msg = " (code: " + e.code;
...@@ -253,7 +254,8 @@ function constructor() { ...@@ -253,7 +254,8 @@ function constructor() {
} }
}); });
ws.on('error', function(e) { ws.on('error', function(e) {
fail("WebSock reported an error"); Util.Warn("WebSocket on-error event");
//fail("WebSock reported an error");
}); });
...@@ -424,16 +426,16 @@ updateState = function(state, statusMsg) { ...@@ -424,16 +426,16 @@ updateState = function(state, statusMsg) {
func = Util.Warn; func = Util.Warn;
} }
cmsg = typeof(statusMsg) !== 'undefined' ? (" Msg: " + statusMsg) : "";
func("New state '" + state + "', was '" + oldstate + "'." + cmsg);
if ((oldstate === 'failed') && (state === 'disconnected')) { if ((oldstate === 'failed') && (state === 'disconnected')) {
// Do disconnect action, but stay in failed state. // Do disconnect action, but stay in failed state
rfb_state = 'failed'; rfb_state = 'failed';
} else { } else {
rfb_state = state; rfb_state = state;
} }
cmsg = typeof(statusMsg) !== 'undefined' ? (" Msg: " + statusMsg) : "";
func("New state '" + rfb_state + "', was '" + oldstate + "'." + cmsg);
if (connTimer && (rfb_state !== 'connect')) { if (connTimer && (rfb_state !== 'connect')) {
Util.Debug("Clearing connect timer"); Util.Debug("Clearing connect timer");
clearInterval(connTimer); clearInterval(connTimer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment