diff --git a/README.md b/README.md index 5a26a7d..2f9d4e2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ encryption, i.e. the "wss://" URI scheme. Special thanks to [Sentry Data Systems](http://www.sentryds.com) for sponsoring ongoing development of this project (and for employing me). +Notable commits, announcements and news are posted to +@noVNC + + ### Screenshots Running in Chrome before and after connecting: @@ -209,7 +213,7 @@ See `vnc.html` and `vnc_auto.html` for examples. The file The `vnc.js` also includes other scripts within the `include` sub-directory. The `VNC_uri_prefix` variable can be use override the -URL path to the directory that contains the `include` sub-directory. +URL path to the `include` sub-directory. ### Troubleshooting @@ -227,6 +231,9 @@ tab. With firefox+firebug, it can be activated using Ctrl+F12. Now reproduce the problem. The console log output will give more information about what is going wrong and where in the code the -problem is located. If you file a issue/bug, it can be very helpful to -copy the last page of console output leading up the problem into the -issue report. +problem is located. + +If you file a issue/bug, it is very helpful for me to have the last +page of console output leading up the problem in the issue report. +Other helpful issue/bug information: browser version, OS version, +noVNC git version, and VNC server name/version. diff --git a/include/rfb.js b/include/rfb.js index fe57209..2ffef1e 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -510,7 +510,7 @@ normal_msg: function () { } switch (msg_type) { case 0: // FramebufferUpdate - ret = RFB.framebufferUpdate(); + ret = RFB.framebufferUpdate(); // false means need more data break; case 1: // SetColourMapEntries Util.Debug("SetColourMapEntries"); @@ -588,7 +588,13 @@ framebufferUpdate: function() { } } - while ((FBU.rects > 0) && (RQ.length >= FBU.bytes)) { + while (FBU.rects > 0) { + if (RFB.state !== "normal") { + return false; + } + if (RQ.length < FBU.bytes) { + return false; + } if (FBU.bytes === 0) { if (RQ.length < 12) { //Util.Debug(" waiting for rect header bytes"); @@ -625,6 +631,7 @@ framebufferUpdate: function() { last_bytes = RQ.length; last_rects = FBU.rects; + // false ret means need more data ret = RFB.encHandlers[FBU.encoding](); now = (new Date()).getTime(); @@ -663,8 +670,6 @@ framebufferUpdate: function() { timing.fbu_rt_start = 0; } } - - if (RFB.state !== "normal") { return true; } } return ret; }, @@ -685,7 +690,7 @@ display_raw: function () { if (RQ.length < FBU.bytes) { //Util.Debug(" waiting for " + // (FBU.bytes - RQ.length) + " RAW bytes"); - return; + return false; } cur_y = FBU.y + (FBU.height - FBU.lines); cur_height = Math.min(FBU.lines, @@ -700,6 +705,7 @@ display_raw: function () { FBU.rects -= 1; FBU.bytes = 0; } + return true; }, display_copy_rect: function () { @@ -710,13 +716,14 @@ display_copy_rect: function () { if (RQ.length < 4) { //Util.Debug(" waiting for " + // (FBU.bytes - RQ.length) + " COPYRECT bytes"); - return; + return false; } old_x = RQ.shift16(); old_y = RQ.shift16(); Canvas.copyImage(old_x, old_y, FBU.x, FBU.y, FBU.width, FBU.height); FBU.rects -= 1; FBU.bytes = 0; + return true; }, display_rre: function () { @@ -726,7 +733,7 @@ display_rre: function () { if (RQ.length < 4 + RFB.fb_Bpp) { //Util.Debug(" waiting for " + // (4 + RFB.fb_Bpp - RQ.length) + " RRE bytes"); - return; + return false; } FBU.subrects = RQ.shift32(); color = RQ.shiftBytes(RFB.fb_Bpp); // Background @@ -752,6 +759,7 @@ display_rre: function () { FBU.bytes = 0; } //Util.Debug("<< display_rre, FBU.bytes: " + FBU.bytes); + return true; }, display_hextile: function() { @@ -772,14 +780,14 @@ display_hextile: function() { FBU.bytes = 1; if (RQ.length < FBU.bytes) { //Util.Debug(" waiting for HEXTILE subencoding byte"); - return; + return false; } subencoding = RQ[0]; // Peek if (subencoding > 30) { // Raw RFB.updateState('failed', "Disconnected: illegal hextile subencoding " + subencoding); //Util.Debug("RQ.slice(0,30):" + RQ.slice(0,30)); - return; + return false; } subrects = 0; cur_tile = FBU.total_tiles - FBU.tiles; @@ -806,7 +814,7 @@ display_hextile: function() { if (RQ.length < FBU.bytes) { /* Wait for subrects byte */ //Util.Debug(" waiting for hextile subrects header byte"); - return; + return false; } subrects = RQ[FBU.bytes-1]; // Peek if (subencoding & 0x10) { // SubrectsColoured @@ -828,7 +836,7 @@ display_hextile: function() { if (RQ.length < FBU.bytes) { //Util.Debug(" waiting for " + // (FBU.bytes - RQ.length) + " hextile bytes"); - return; + return false; } /* We know the encoding and have a whole tile */ @@ -890,6 +898,7 @@ display_hextile: function() { } //Util.Debug("<< display_hextile"); + return true; }, @@ -905,7 +914,7 @@ display_tight_png: function() { FBU.bytes = 1; // compression-control byte if (RQ.length < FBU.bytes) { Util.Debug(" waiting for TIGHT compression-control byte"); - return; + return false; } // Get 'compact length' header and data size @@ -939,7 +948,7 @@ display_tight_png: function() { if (RQ.length < FBU.bytes) { Util.Debug(" waiting for TIGHT " + cmode + " bytes"); - return; + return false; } //Util.Debug(" RQ.slice(0,20): " + RFB.RQ.slice(0,20) + " (" + RFB.RQ.length + ")"); @@ -958,7 +967,7 @@ display_tight_png: function() { FBU.bytes = 1 + clength[0] + clength[1]; // ctl + clength size + jpeg-data if (RQ.length < FBU.bytes) { Util.Debug(" waiting for TIGHT " + cmode + " bytes"); - return; + return false; } // We have everything, render it @@ -977,6 +986,7 @@ display_tight_png: function() { //Util.Debug(" ending RQ.length: " + RQ.length); //Util.Debug(" ending RQ.slice(0,20): " + RQ.slice(0,20)); //Util.Debug("<< display_tight_png"); + return true; }, extract_data_uri : function (arr) { @@ -1016,6 +1026,7 @@ set_desktopsize : function () { RFB.FBU.rects -= 1; Util.Debug("<< set_desktopsize"); + return true; }, set_cursor: function () { @@ -1045,6 +1056,7 @@ set_cursor: function () { RFB.FBU.rects -= 1; //Util.Debug("<< set_cursor"); + return true; }, set_jpeg_quality : function () { @@ -1241,16 +1253,15 @@ handle_message: function () { RFB.disconnect(); break; case 'normal': - RFB.normal_msg(); - /* - while (RFB.RQ.length > 0) { - if (RFB.normal_msg() && RFB.state === 'normal') { - Util.Debug("More to process"); + while ((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; } } - */ break; default: RFB.init_msg(); diff --git a/tests/canvas.html b/tests/canvas.html index bd1a363..e762acd 100644 --- a/tests/canvas.html +++ b/tests/canvas.html @@ -1,9 +1,10 @@