SEBWIN-311: Removed timeout for client initialization procedure to avoid application termination if user doesn't provide input within timeout.
This commit is contained in:
		
							parent
							
								
									b72c37273e
								
							
						
					
					
						commit
						8d0d1832a9
					
				
					 5 changed files with 11 additions and 22 deletions
				
			
		|  | @ -130,10 +130,13 @@ namespace SafeExamBrowser.Client.Operations | |||
| 			var failed = new List<RunningApplication>(); | ||||
| 			var result = OperationResult.Success; | ||||
| 
 | ||||
| 			logger.Info($"The following applications need to be terminated: {string.Join(", ", runningApplications.Select(a => a.Name))}."); | ||||
| 			ActionRequired?.Invoke(args); | ||||
| 
 | ||||
| 			if (args.TerminateProcesses) | ||||
| 			{ | ||||
| 				logger.Info($"The user chose to automatically terminate all running applications."); | ||||
| 
 | ||||
| 				foreach (var application in runningApplications) | ||||
| 				{ | ||||
| 					var success = applicationMonitor.TryTerminate(application); | ||||
|  | @ -152,6 +155,7 @@ namespace SafeExamBrowser.Client.Operations | |||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				logger.Info("The user chose not to automatically terminate all running applications. Aborting..."); | ||||
| 				result = OperationResult.Aborted; | ||||
| 			} | ||||
| 
 | ||||
|  |  | |||
|  | @ -56,8 +56,8 @@ namespace SafeExamBrowser.Monitoring.Applications | |||
| 				whitelist.Add(application); | ||||
| 			} | ||||
| 
 | ||||
| 			logger.Debug($"Initialized blacklist with {blacklist.Count} applications: {string.Join(", ", blacklist.Select(a => a.ExecutableName))}"); | ||||
| 			logger.Debug($"Initialized whitelist with {whitelist.Count} applications: {string.Join(", ", whitelist.Select(a => a.ExecutableName))}"); | ||||
| 			logger.Debug($"Initialized blacklist with {blacklist.Count} applications{(blacklist.Any() ? $": {string.Join(", ", blacklist.Select(a => a.ExecutableName))}" : ".")}"); | ||||
| 			logger.Debug($"Initialized whitelist with {whitelist.Count} applications{(whitelist.Any() ? $": {string.Join(", ", whitelist.Select(a => a.ExecutableName))}" : ".")}"); | ||||
| 
 | ||||
| 			foreach (var process in processFactory.GetAllRunning()) | ||||
| 			{ | ||||
|  |  | |||
|  | @ -15,11 +15,11 @@ using SafeExamBrowser.Communication.Contracts.Data; | |||
| using SafeExamBrowser.Communication.Contracts.Hosts; | ||||
| using SafeExamBrowser.Communication.Contracts.Proxies; | ||||
| using SafeExamBrowser.Configuration.Contracts; | ||||
| using SafeExamBrowser.Settings; | ||||
| using SafeExamBrowser.Core.Contracts.OperationModel; | ||||
| using SafeExamBrowser.Logging.Contracts; | ||||
| using SafeExamBrowser.WindowsApi.Contracts; | ||||
| using SafeExamBrowser.Runtime.Operations; | ||||
| using SafeExamBrowser.Settings; | ||||
| using SafeExamBrowser.WindowsApi.Contracts; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Runtime.UnitTests.Operations | ||||
| { | ||||
|  | @ -88,20 +88,6 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations | |||
| 			Assert.AreEqual(OperationResult.Success, result); | ||||
| 		} | ||||
| 
 | ||||
| 		[TestMethod] | ||||
| 		public void Perform_MustFailStartupIfClientNotStartedWithinTimeout() | ||||
| 		{ | ||||
| 			var result = default(OperationResult); | ||||
| 
 | ||||
| 			processFactory.Setup(f => f.StartNew(It.IsAny<string>(), It.IsAny<string[]>())).Returns(process.Object); | ||||
| 
 | ||||
| 			result = sut.Perform(); | ||||
| 
 | ||||
| 			Assert.IsNull(sessionContext.ClientProxy); | ||||
| 			Assert.AreEqual(process.Object, sessionContext.ClientProcess); | ||||
| 			Assert.AreEqual(OperationResult.Failed, result); | ||||
| 		} | ||||
| 
 | ||||
| 		[TestMethod] | ||||
| 		public void Perform_MustFailStartupImmediatelyIfClientTerminates() | ||||
| 		{ | ||||
|  |  | |||
|  | @ -119,7 +119,7 @@ namespace SafeExamBrowser.Runtime.Operations | |||
| 			ClientProcess.Terminated += clientTerminatedEventHandler; | ||||
| 
 | ||||
| 			logger.Info("Waiting for client to complete initialization..."); | ||||
| 			clientReady = clientReadyEvent.WaitOne(timeout_ms); | ||||
| 			clientReady = clientReadyEvent.WaitOne(); | ||||
| 
 | ||||
| 			runtimeHost.AllowConnection = false; | ||||
| 			runtimeHost.AuthenticationToken = default(Guid?); | ||||
|  | @ -133,7 +133,7 @@ namespace SafeExamBrowser.Runtime.Operations | |||
| 
 | ||||
| 			if (!clientReady) | ||||
| 			{ | ||||
| 				logger.Error($"Failed to start client within {timeout_ms / 1000} seconds!"); | ||||
| 				logger.Error($"Failed to start client!"); | ||||
| 			} | ||||
| 
 | ||||
| 			if (clientTerminated) | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ namespace SafeExamBrowser.WindowsApi | |||
| 
 | ||||
| 			try | ||||
| 			{ | ||||
| 				using (var searcher = new ManagementObjectSearcher($"SELECT Name, ProcessId, ExecutablePath FROM Win32_Process")) | ||||
| 				using (var searcher = new ManagementObjectSearcher($"SELECT ProcessId, ExecutablePath FROM Win32_Process")) | ||||
| 				using (var results = searcher.Get()) | ||||
| 				{ | ||||
| 					var processData = results.Cast<ManagementObject>().ToList(); | ||||
|  | @ -103,7 +103,6 @@ namespace SafeExamBrowser.WindowsApi | |||
| 						using (process) | ||||
| 						{ | ||||
| 							var processId = Convert.ToInt32(process["ProcessId"]); | ||||
| 							var processName = Convert.ToString(process["Name"]); | ||||
| 							var executablePath = Convert.ToString(process["ExecutablePath"]); | ||||
| 
 | ||||
| 							if (File.Exists(executablePath)) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 dbuechel
						dbuechel