GUACAMOLE-346: Seek operations should be atomic with respect to the various 
timeouts.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/21eadec6
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/21eadec6
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/21eadec6

Branch: refs/heads/master
Commit: 21eadec6a459d6dec192ccea2a00ea3b600e735a
Parents: 23cf840
Author: Michael Jumper <[email protected]>
Authored: Sat Jul 15 16:15:01 2017 -0700
Committer: Michael Jumper <[email protected]>
Committed: Sat Jul 15 16:15:56 2017 -0700

----------------------------------------------------------------------
 .../src/main/webapp/modules/SessionRecording.js | 40 ++++++++++----------
 1 file changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/21eadec6/guacamole-common-js/src/main/webapp/modules/SessionRecording.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js 
b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js
index c4279ee..d544982 100644
--- a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js
+++ b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js
@@ -330,35 +330,35 @@ Guacamole.SessionRecording = function 
SessionRecording(tunnel) {
      */
     var seekToFrame = function seekToFrame(index, callback) {
 
-        var startIndex;
-
         // Abort any in-progress seek
         abortSeek();
 
-        // Back up until startIndex represents current state
-        for (startIndex = index; startIndex >= 0; startIndex--) {
+        // Replay frames asynchronously
+        seekTimeout = window.setTimeout(function continueSeek() {
 
-            var frame = frames[startIndex];
+            var startIndex;
 
-            // If we've reached the current frame, startIndex represents
-            // current state by definition
-            if (startIndex === currentFrame)
-                break;
+            // Back up until startIndex represents current state
+            for (startIndex = index; startIndex >= 0; startIndex--) {
 
-            // If frame has associated absolute state, make that frame the
-            // current state
-            if (frame.clientState) {
-                playbackClient.importState(frame.clientState);
-                break;
-            }
+                var frame = frames[startIndex];
 
-        }
+                // If we've reached the current frame, startIndex represents
+                // current state by definition
+                if (startIndex === currentFrame)
+                    break;
 
-        // Advance to frame index after current state
-        startIndex++;
+                // If frame has associated absolute state, make that frame the
+                // current state
+                if (frame.clientState) {
+                    playbackClient.importState(frame.clientState);
+                    break;
+                }
 
-        // Replay frames asynchronously
-        seekTimeout = window.setTimeout(function continueSeek() {
+            }
+
+            // Advance to frame index after current state
+            startIndex++;
 
             var startTime = new Date().getTime();
 

Reply via email to