From 9fc59562a1a47e795d21e698f73fafa80717bce9 Mon Sep 17 00:00:00 2001 From: primalmotion Date: Thu, 29 Jul 2010 13:52:56 +0200 Subject: [PATCH] * removing use strict * apply kanaka's patch for letting other events to have a chance to run when RFB is heavy loaded --- .gitignore | 1 + include/canvas.js | 4 ++-- include/rfb.js | 11 +++++------ include/util.js | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index b8e9884..ad5ff9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc *.o wsproxy +*.DS_Store diff --git a/include/canvas.js b/include/canvas.js index 427481c..f670741 100644 --- a/include/canvas.js +++ b/include/canvas.js @@ -6,12 +6,12 @@ * See README.md for usage and integration instructions. */ -"use strict"; +//"use strict"; /*jslint white: false, bitwise: false */ /*global window, $, Util, Base64 */ // Globals defined here -// var Canvas; +//var Canvas; // Everything namespaced inside Canvas Canvas = { diff --git a/include/rfb.js b/include/rfb.js index 2ffef1e..9066539 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -6,12 +6,12 @@ * See README.md for usage and integration instructions. */ -"use strict"; +//"use strict"; /*jslint white: false, nomen: false, browser: true, bitwise: false */ /*global window, WebSocket, Util, Canvas, VNC_native_ws, Base64, DES */ // Globals defined here -// var RFB; +//var RFB; /* * RFB namespace @@ -1253,13 +1253,12 @@ handle_message: function () { RFB.disconnect(); break; case 'normal': - while ((RFB.state === 'normal') && (RFB.RQ.length > 0)) { + if ((RFB.state === 'normal') && (RFB.RQ.length > 0)) { if (RFB.normal_msg()) { // true means we can continue processing Util.Debug("More data to process"); - } else { - // false means we need more data - break; + // Give other events a chance to run + setTimeout(RFB.handle_message, 10); } } break; diff --git a/include/util.js b/include/util.js index 124f560..1488d3a 100644 --- a/include/util.js +++ b/include/util.js @@ -6,7 +6,7 @@ * See README.md for usage and integration instructions. */ -"use strict"; +//"use strict"; /*jslint bitwise: false, white: false */ /*global window, document, navigator, ActiveXObject*/ @@ -35,10 +35,10 @@ Util.init_logging = function (level) { Util.Debug = Util.Info = Util.Warn = Util.Error = function (msg) {}; switch (level) { - case 'debug': Util.Debug = function (msg) { console.log(msg); }; - case 'info': Util.Info = function (msg) { console.log(msg); }; - case 'warn': Util.Warn = function (msg) { console.warn(msg); }; - case 'error': Util.Error = function (msg) { console.error(msg); }; + case 'debug': Util.Debug = function (msg) { /*console.log(msg);*/ }; + case 'info': Util.Info = function (msg) { /*console.log(msg);*/ }; + case 'warn': Util.Warn = function (msg) { /*console.warn(msg);*/ }; + case 'error': Util.Error = function (msg) { /*console.error(msg);*/ }; break; default: throw("invalid logging type '" + level + "'"); @@ -47,7 +47,7 @@ Util.init_logging = function (level) { // Initialize logging level Util.init_logging( (document.location.href.match( /logging=([A-Za-z0-9\._\-]*)/) || - ['', 'warn'])[1] ); + ['', 'error'])[1] ); /* * Simple DOM selector by ID