Skip to content

Commit

Permalink
Resolve some errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Sep 13, 2024
1 parent 37a3159 commit b52210c
Show file tree
Hide file tree
Showing 107 changed files with 511 additions and 899 deletions.
Binary file added .assets/favicon.ico
Binary file not shown.
11 changes: 0 additions & 11 deletions ControlR.Agent/Services/AgentHubConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ public async Task SendTerminalOutputToViewer(string viewerConnectionId, Terminal

public async Task StartAsync(CancellationToken cancellationToken)
{
_messenger.Unregister<GenericMessage<GenericMessageKind>>(this);
_messenger.RegisterGenericMessage(this, HandleGenericMessage);
await Connect(
() => new Uri(_settings.ServerUri, "/hubs/agent"),
ConfigureConnection,
Expand Down Expand Up @@ -254,15 +252,6 @@ private void ConfigureHttpOptions(HttpConnectionOptions options)
options.Transports = HttpTransportType.WebSockets;
}

private async Task HandleGenericMessage(object subscriber, GenericMessageKind kind)
{
if (kind == GenericMessageKind.ServerUriChanged)
{
await StopAsync(_appLifetime.ApplicationStopping);
await StartAsync(_appLifetime.ApplicationStopping);
}
}

private async Task HubConnection_Reconnected(string? arg)
{
await SendDeviceHeartbeat();
Expand Down
32 changes: 1 addition & 31 deletions ControlR.Agent/Services/SettingsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
using Bitbound.SimpleMessenger;
using ControlR.Agent.Options;
using ControlR.Agent.Options;
using ControlR.Agent.Startup;
using ControlR.Libraries.DevicesCommon.Services;
using ControlR.Libraries.Shared.Models;
using ControlR.Libraries.Shared.Services;
using ControlR.Libraries.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Text.Json;
using ControlR.Libraries.Shared.Dtos;

namespace ControlR.Agent.Services;

Expand All @@ -25,8 +18,6 @@ internal interface ISettingsProvider

internal class SettingsProvider(
IOptionsMonitor<AgentAppOptions> _appOptions,
IMessenger _messenger,
IDelayer _delayer,
IFileSystem _fileSystem,
IOptions<InstanceOptions> _instanceOptions,
ILogger<SettingsProvider> _logger) : ISettingsProvider
Expand Down Expand Up @@ -98,28 +89,7 @@ public async Task UpdateSettings(AgentAppSettings settings)
await _updateLock.WaitAsync();
try
{
var newServerUri = settings.AppOptions.ServerUri;

var serverUriChanged = newServerUri != ServerUri;

await WriteToDisk(settings);

if (serverUriChanged)
{
var waitResult = await _delayer.WaitForAsync(
() => ServerUri == newServerUri,
TimeSpan.FromSeconds(5));

if (!waitResult)
{
_logger.LogError(
"ServerUri changed in appsettings, but timed out while waiting " +
"for value to change in the options monitor.");
return;
}

await _messenger.SendGenericMessage(GenericMessageKind.ServerUriChanged);
}
}
catch (Exception ex)
{
Expand Down
1 change: 0 additions & 1 deletion ControlR.Agent/Startup/IHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ internal static IHostBuilder AddControlRAgent(this IHostBuilder builder, Startup
services.AddSingleton<IEnvironmentHelper>(_ => EnvironmentHelper.Instance);
services.AddSingleton<IFileSystem, FileSystem>();
services.AddTransient<IHubConnectionBuilder, HubConnectionBuilder>();
services.AddSingleton<IKeyProvider, KeyProvider>();
services.AddSingleton<IStreamingSessionCache, StreamingSessionCache>();
services.AddSingleton(WeakReferenceMessenger.Default);
services.AddSingleton<ISystemTime, SystemTime>();
Expand Down
9 changes: 9 additions & 0 deletions ControlR.Agent/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
global using Bitbound.SimpleMessenger;
global using ControlR.Libraries.DevicesCommon.Services;
global using ControlR.Libraries.Shared.Models;
global using ControlR.Libraries.Shared.Services;
global using ControlR.Libraries.Shared;
global using ControlR.Libraries.Shared.Dtos;
global using ControlR.Libraries.Clients.Extensions;
global using ControlR.Libraries.Clients.Messages;
global using Microsoft.Extensions.Logging;
24 changes: 0 additions & 24 deletions ControlR.Server/Api/KeyController.cs

This file was deleted.

35 changes: 0 additions & 35 deletions ControlR.Server/ControlR.Server.csproj

This file was deleted.

33 changes: 0 additions & 33 deletions ControlR.Server/Dockerfile

This file was deleted.

62 changes: 0 additions & 62 deletions ControlR.Server/Extensions/TelemetryExtensions.cs

This file was deleted.

7 changes: 0 additions & 7 deletions ControlR.Server/GlobalUsings.cs

This file was deleted.

Loading

0 comments on commit b52210c

Please sign in to comment.