Fixed race condition between service and runtime, occurring when the runtime initiated a new session before the service was able to terminate the currently running one.
This commit is contained in:
parent
0159b9c0de
commit
6511401fa4
1 changed files with 8 additions and 9 deletions
|
@ -42,10 +42,16 @@ namespace SafeExamBrowser.Service.Operations
|
|||
public override OperationResult Revert()
|
||||
{
|
||||
var success = true;
|
||||
var wasRunning = Context.IsRunning;
|
||||
|
||||
logger.Info("Finalizing current session...");
|
||||
logger.Info("Starting auto-restore mechanism...");
|
||||
Context.AutoRestoreMechanism.Start();
|
||||
|
||||
if (Context.ServiceEvent != null && Context.IsRunning)
|
||||
logger.Info("Clearing session data...");
|
||||
Context.Configuration = null;
|
||||
Context.IsRunning = false;
|
||||
|
||||
if (Context.ServiceEvent != null && wasRunning)
|
||||
{
|
||||
success = Context.ServiceEvent.Set();
|
||||
|
||||
|
@ -59,13 +65,6 @@ namespace SafeExamBrowser.Service.Operations
|
|||
}
|
||||
}
|
||||
|
||||
logger.Info("Starting auto-restore mechanism...");
|
||||
Context.AutoRestoreMechanism.Start();
|
||||
|
||||
logger.Info("Clearing session data...");
|
||||
Context.Configuration = null;
|
||||
Context.IsRunning = false;
|
||||
|
||||
return success ? OperationResult.Success : OperationResult.Failed;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue