diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2023-01-21 11:20:43 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2023-01-21 11:20:43 -0600 |
| commit | 68967df8b01088a88f517c75ef94e9bac8dd6dad (patch) | |
| tree | 4d8342f58579b76422008669b71a894a7cdc00a5 /src/slskd/Relay/NullRelayClient.cs | |
| parent | cbf0c9749c0eb64c47e9ab09b8d0453a37c70f8e (diff) | |
| download | slskd-68967df8b01088a88f517c75ef94e9bac8dd6dad.tar.gz | |
rename Dummy client to Null
Diffstat (limited to 'src/slskd/Relay/NullRelayClient.cs')
| -rw-r--r-- | src/slskd/Relay/NullRelayClient.cs | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/slskd/Relay/NullRelayClient.cs b/src/slskd/Relay/NullRelayClient.cs new file mode 100644 index 00000000..d86e994f --- /dev/null +++ b/src/slskd/Relay/NullRelayClient.cs @@ -0,0 +1,77 @@ +// <copyright file="NullRelayClient.cs" company="slskd Team"> +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// </copyright> + +namespace slskd.Relay +{ + using System.Threading; + using System.Threading.Tasks; + + /// <summary> + /// A non-operarable Relay client. + /// </summary> + public class NullRelayClient : IRelayClient + { + /// <summary> + /// Gets the client state. + /// </summary> + public IStateMonitor<RelayClientState> StateMonitor { get; set; } = new ManagedState<RelayClientState>(); + + private bool Disposed { get; set; } + + /// <summary> + /// Disposes this instance. + /// </summary> + public void Dispose() + { + Dispose(disposing: true); + System.GC.SuppressFinalize(this); + } + + /// <summary> + /// Starts the client and connects to the controller. + /// </summary> + /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> + /// <returns>The operation context.</returns> + public Task StartAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; + + /// <summary> + /// Stops the client and disconnects from the controller. + /// </summary> + /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> + /// <returns>The operation context.</returns> + public Task StopAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; + + /// <summary> + /// Synchronizes state with the controller. + /// </summary> + /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> + /// <returns>The operation context.</returns> + public Task SynchronizeAsync(CancellationToken cancellationToken = default) => Task.CompletedTask; + + /// <summary> + /// Disposes this instance. + /// </summary> + /// <param name="disposing">Disposing.</param> + protected virtual void Dispose(bool disposing) + { + if (!Disposed) + { + Disposed = true; + } + } + } +}
\ No newline at end of file |
