Fixed potential layer sync issue (if multiple layers are used, and multiple layers...
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Sun, 3 Apr 2011 07:53:00 +0000 (00:53 -0700)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Sun, 3 Apr 2011 07:53:00 +0000 (00:53 -0700)
src/main/resources/guacamole.js

index 2d2fdce..4e4831c 100644 (file)
@@ -333,17 +333,22 @@ function GuacamoleClient(display, tunnel) {
 
             }
 
-            // Count active layers and install sync tracking hook
+            // Count active, not-ready layers and install sync tracking hooks
             for (var i=0; i<layers.length; i++) {
 
                 var layer = layers[i];
-                if (layer) {
+                if (layer && !layer.isReady()) {
                     layersToSync++;
                     layer.sync(syncLayer);
                 }
 
             }
 
+            // If all layers are ready, then we didn't install any hooks.
+            // Send sync message now,
+            if (layersToSync == 0)
+                tunnel.sendMessage("sync:" + timestamp + ";");
+
         },
       
     };