diff --git a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs
index 3d2c704d..8ebb9480 100644
--- a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs
+++ b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs
@@ -286,7 +286,7 @@ namespace SafeExamBrowser.Browser.Handlers
{
try
{
- var location = locations.FirstOrDefault(l => l.Contains("moodle/login/index.php?testsession"));
+ var location = locations.FirstOrDefault(l => l.Contains("/login/index.php?testsession"));
if (location != default(string))
{
diff --git a/SafeExamBrowser.Client/Operations/ServerOperation.cs b/SafeExamBrowser.Client/Operations/ServerOperation.cs
index f90d6bdf..2f56d402 100644
--- a/SafeExamBrowser.Client/Operations/ServerOperation.cs
+++ b/SafeExamBrowser.Client/Operations/ServerOperation.cs
@@ -41,8 +41,6 @@ namespace SafeExamBrowser.Client.Operations
public override OperationResult Perform()
{
- var result = OperationResult.Success;
-
if (Context.Settings.SessionMode == SessionMode.Server)
{
logger.Info("Initializing server...");
@@ -54,15 +52,18 @@ namespace SafeExamBrowser.Client.Operations
Context.AppConfig.ServerExamId,
Context.AppConfig.ServerOauth2Token,
Context.Settings.Server);
+
+ if (Context.AppConfig.ServerConnectivityAutoStart)
+ {
+ server.StartConnectivity();
+ }
}
- return result;
+ return OperationResult.Success;
}
public override OperationResult Revert()
{
- var result = OperationResult.Success;
-
if (Context.Settings?.SessionMode == SessionMode.Server)
{
logger.Info("Finalizing server...");
@@ -71,7 +72,7 @@ namespace SafeExamBrowser.Client.Operations
server.StopConnectivity();
}
- return result;
+ return OperationResult.Success;
}
}
}
diff --git a/SafeExamBrowser.Configuration.Contracts/AppConfig.cs b/SafeExamBrowser.Configuration.Contracts/AppConfig.cs
index e5479d02..5fe9b2aa 100644
--- a/SafeExamBrowser.Configuration.Contracts/AppConfig.cs
+++ b/SafeExamBrowser.Configuration.Contracts/AppConfig.cs
@@ -161,6 +161,11 @@ namespace SafeExamBrowser.Configuration.Contracts
///
public string ServerConnectionToken { get; set; }
+ ///
+ /// Determines whether the server connectivity should automatically be started in case of a reconfiguration.
+ ///
+ public bool ServerConnectivityAutoStart { get; set; }
+
///
/// The identifier of the selected server exam.
///
diff --git a/SafeExamBrowser.Runtime/Operations/ServerOperation.cs b/SafeExamBrowser.Runtime/Operations/ServerOperation.cs
index 0e7802d0..3c64f037 100644
--- a/SafeExamBrowser.Runtime/Operations/ServerOperation.cs
+++ b/SafeExamBrowser.Runtime/Operations/ServerOperation.cs
@@ -135,8 +135,11 @@ namespace SafeExamBrowser.Runtime.Operations
{
if (Context.Current.Settings.SessionMode == SessionMode.Server)
{
+ logger.Info("Initializing server configuration for next session...");
+
Context.Next.AppConfig.ServerApi = Context.Current.AppConfig.ServerApi;
Context.Next.AppConfig.ServerConnectionToken = Context.Current.AppConfig.ServerConnectionToken;
+ Context.Next.AppConfig.ServerConnectivityAutoStart = true;
Context.Next.AppConfig.ServerExamId = Context.Current.AppConfig.ServerExamId;
Context.Next.AppConfig.ServerOauth2Token = Context.Current.AppConfig.ServerOauth2Token;
diff --git a/SafeExamBrowser.Server/ServerProxy.cs b/SafeExamBrowser.Server/ServerProxy.cs
index b6506fec..e93a348d 100644
--- a/SafeExamBrowser.Server/ServerProxy.cs
+++ b/SafeExamBrowser.Server/ServerProxy.cs
@@ -321,9 +321,14 @@ namespace SafeExamBrowser.Server
if (success)
{
- if (TryParseInstruction(response.Content, out var instruction) && instruction == "SEB_QUIT")
+ if (TryParseInstruction(response.Content, out var instruction))
{
- Task.Run(() => TerminationRequested?.Invoke());
+ switch (instruction)
+ {
+ case "SEB_QUIT":
+ Task.Run(() => TerminationRequested?.Invoke());
+ break;
+ }
}
}
else