Skip to content

Commit

Permalink
Implement submodule changes. Handle task cancellation in CpuUtilizati…
Browse files Browse the repository at this point in the history
…onSampler.
  • Loading branch information
bitbound committed Jun 1, 2023
1 parent 4f9f3cb commit 382a9a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Agent/Services/CpuUtilizationSampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
10 changes: 10 additions & 0 deletions Server/Services/RcImplementations/HubEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 382a9a6

Please sign in to comment.