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

This commit is contained in:
Michael Jumper
2017-07-15 16:15:01 -07:00
parent 23cf840ba6
commit 21eadec6a4

View File

@@ -330,11 +330,14 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
*/ */
var seekToFrame = function seekToFrame(index, callback) { var seekToFrame = function seekToFrame(index, callback) {
var startIndex;
// Abort any in-progress seek // Abort any in-progress seek
abortSeek(); abortSeek();
// Replay frames asynchronously
seekTimeout = window.setTimeout(function continueSeek() {
var startIndex;
// Back up until startIndex represents current state // Back up until startIndex represents current state
for (startIndex = index; startIndex >= 0; startIndex--) { for (startIndex = index; startIndex >= 0; startIndex--) {
@@ -357,9 +360,6 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
// Advance to frame index after current state // Advance to frame index after current state
startIndex++; startIndex++;
// Replay frames asynchronously
seekTimeout = window.setTimeout(function continueSeek() {
var startTime = new Date().getTime(); var startTime = new Date().getTime();
// Replay any applicable incremental frames // Replay any applicable incremental frames