mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-346: Seek operations should be atomic with respect to the various timeouts.
This commit is contained in:
@@ -330,36 +330,36 @@ 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();
|
||||||
|
|
||||||
// Back up until startIndex represents current state
|
|
||||||
for (startIndex = index; startIndex >= 0; startIndex--) {
|
|
||||||
|
|
||||||
var frame = frames[startIndex];
|
|
||||||
|
|
||||||
// If we've reached the current frame, startIndex represents
|
|
||||||
// current state by definition
|
|
||||||
if (startIndex === currentFrame)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// If frame has associated absolute state, make that frame the
|
|
||||||
// current state
|
|
||||||
if (frame.clientState) {
|
|
||||||
playbackClient.importState(frame.clientState);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advance to frame index after current state
|
|
||||||
startIndex++;
|
|
||||||
|
|
||||||
// Replay frames asynchronously
|
// Replay frames asynchronously
|
||||||
seekTimeout = window.setTimeout(function continueSeek() {
|
seekTimeout = window.setTimeout(function continueSeek() {
|
||||||
|
|
||||||
|
var startIndex;
|
||||||
|
|
||||||
|
// Back up until startIndex represents current state
|
||||||
|
for (startIndex = index; startIndex >= 0; startIndex--) {
|
||||||
|
|
||||||
|
var frame = frames[startIndex];
|
||||||
|
|
||||||
|
// If we've reached the current frame, startIndex represents
|
||||||
|
// current state by definition
|
||||||
|
if (startIndex === currentFrame)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// If frame has associated absolute state, make that frame the
|
||||||
|
// current state
|
||||||
|
if (frame.clientState) {
|
||||||
|
playbackClient.importState(frame.clientState);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Advance to frame index after current state
|
||||||
|
startIndex++;
|
||||||
|
|
||||||
var startTime = new Date().getTime();
|
var startTime = new Date().getTime();
|
||||||
|
|
||||||
// Replay any applicable incremental frames
|
// Replay any applicable incremental frames
|
||||||
|
Reference in New Issue
Block a user