diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-01-30 20:41:22 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-30 20:41:22 -0600 |
| commit | 57b2584efac2548011eb59fbda61f32d5d161ee0 (patch) | |
| tree | c9db3100a1920009a20ceb59c310cc6f8296dbe5 /src/slskd/Relay/NullRelayClient.cs | |
| parent | 84f75d569bef855fc1b14e4ab2c42f01eeda873d (diff) | |
| parent | 4278d95a8923178563f54fbcbb4586638921e665 (diff) | |
| download | slskd-57b2584efac2548011eb59fbda61f32d5d161ee0.tar.gz | |
Merge branch 'master' into port
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 |
