Fixed potential layer sync issue (if multiple layers are used, and multiple layers are ready, multiply unnecessary sync responses may be sent for a single sync instruction)

This commit is contained in:
Michael Jumper
2011-04-03 00:53:00 -07:00
parent 64224d0937
commit f6c2d0c88f

View 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 + ";");
},
};