Commit af183e63 authored by Joel Martin's avatar Joel Martin

update failed state on WS onerror.

Also, slightly faster non-base64 (UTF-8) decode.
parent 97df09b9
...@@ -170,7 +170,8 @@ clipboardPasteFrom: function (text) { ...@@ -170,7 +170,8 @@ clipboardPasteFrom: function (text) {
ws : null, // Web Socket object ws : null, // Web Socket object
sendID : null, sendID : null,
use_seq : false, use_seq : false,
b64encode : true, b64encode : true, // false means UTF-8 on the wire
//b64encode : false, // false means UTF-8 on the wire
// Receive and send queues // Receive and send queues
RQ : [], // Receive Queue RQ : [], // Receive Queue
...@@ -937,9 +938,11 @@ decode_message: function(data, offset) { ...@@ -937,9 +938,11 @@ decode_message: function(data, offset) {
if (RFB.b64encode) { if (RFB.b64encode) {
RFB.RQ = RFB.RQ.concat(Base64.decode(data, offset)); RFB.RQ = RFB.RQ.concat(Base64.decode(data, offset));
} else { } else {
RFB.RQ = RFB.RQ.concat(data.split('').slice(offset). // A bit faster in firefox
map(function (chr) { var i, length = data.length, RQ = RFB.RQ;
return (chr.charCodeAt(0) % 256); })); for (i=offset; i < length; i++) {
RQ.push(data.charCodeAt(i) % 256);
}
} }
//console.log(">> decode_message, RQ: " + RFB.RQ); //console.log(">> decode_message, RQ: " + RFB.RQ);
}, },
...@@ -1275,7 +1278,7 @@ init_ws: function () { ...@@ -1275,7 +1278,7 @@ init_ws: function () {
}; };
RFB.ws.onerror = function(e) { RFB.ws.onerror = function(e) {
console.error(">> WebSocket.onerror"); console.error(">> WebSocket.onerror");
console.error(" " + e); RFB.updateState('failed', "WebSocket error");
console.error("<< WebSocket.onerror"); console.error("<< WebSocket.onerror");
}; };
......
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