From 382a9a6c320ff0d1aa5b03d379ee1a393be350ad Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Thu, 1 Jun 2023 15:24:10 -0700 Subject: [PATCH] Implement submodule changes. Handle task cancellation in CpuUtilizationSampler. --- Agent/Services/CpuUtilizationSampler.cs | 6 +++++- Server/Services/RcImplementations/HubEventHandler.cs | 10 ++++++++++ submodules/Immense.RemoteControl | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Agent/Services/CpuUtilizationSampler.cs b/Agent/Services/CpuUtilizationSampler.cs index 23f298f58..13f4da357 100644 --- a/Agent/Services/CpuUtilizationSampler.cs +++ b/Agent/Services/CpuUtilizationSampler.cs @@ -39,12 +39,16 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) { var currentUtil = await GetCpuUtilization(stoppingToken); Interlocked.Exchange(ref _currentUtilization, currentUtil); + await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); + } + catch (TaskCanceledException) + { + _logger.LogInformation("Task canceled while taking CPU utilization sample. Application may be shutting down."); } catch (Exception ex) { _logger.LogError(ex, "Error while getting CPU utilization sample."); } - await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); } } diff --git a/Server/Services/RcImplementations/HubEventHandler.cs b/Server/Services/RcImplementations/HubEventHandler.cs index 3a7e8eb66..409e1f9ad 100644 --- a/Server/Services/RcImplementations/HubEventHandler.cs +++ b/Server/Services/RcImplementations/HubEventHandler.cs @@ -62,6 +62,16 @@ public Task InvokeCtrlAltDel(RemoteControlSession session, string viewerConnecti return _serviceHub.Clients.Client(ex.AgentConnectionId).SendAsync("CtrlAltDel"); } + public Task NotifyRemoteControlEnded(RemoteControlSession sessionInfo) + { + return Task.CompletedTask; + } + + public Task NotifyRemoteControlStarted(RemoteControlSession sessionInfo) + { + return Task.CompletedTask; + } + public Task NotifySessionChanged(RemoteControlSession session, SessionSwitchReasonEx reason, int currentSessionId) { if (session is not RemoteControlSessionEx ex) diff --git a/submodules/Immense.RemoteControl b/submodules/Immense.RemoteControl index 1d982bd8e..ae9ce5044 160000 --- a/submodules/Immense.RemoteControl +++ b/submodules/Immense.RemoteControl @@ -1 +1 @@ -Subproject commit 1d982bd8ecdb4b249d8540682cc22c67d0f01689 +Subproject commit ae9ce504427e301683c1b68aef87f7622d75bc42