update failed state on WS onerror.
Also, slightly faster non-base64 (UTF-8) decode.
This commit is contained in:
parent
97df09b9f1
commit
af183e63f5
13
vnc.js
13
vnc.js
|
@ -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) {
|
||||||
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 () {
|
||||||
};
|
};
|
||||||
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");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue