diff options
| author | Matt Goldspink <mattgoldspink1@gmail.com> | 2023-02-03 11:18:22 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-03 11:18:22 -0800 |
| commit | 7051348242058fc50c0fb474d011b90ff2c09071 (patch) | |
| tree | ead84e30d063372dbc6c04b1a453e8130e935234 /src/slskd/Relay/NullRelayClient.cs | |
| parent | d1177d526898da0597718e5f4b2307ea558db100 (diff) | |
| parent | 3162a3f7964e924372a7744f4ce02951894dfe38 (diff) | |
| download | slskd-7051348242058fc50c0fb474d011b90ff2c09071.tar.gz | |
Merge branch 'slskd:master' into feature/dark-mode
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 |
