diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-07-12 14:03:47 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-07-12 14:03:47 -0500 |
| commit | 7f3f214a03281aea665d9ea58096ddb65a332f31 (patch) | |
| tree | 52e59022889d664ed663eddc73ac267ea69aa311 /src | |
| parent | 7d302ce2a65bac34f0795ce5eafb3e06b746872d (diff) | |
| download | slskd-7f3f214a03281aea665d9ea58096ddb65a332f31.tar.gz | |
add watchdog state
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/State.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/slskd/Core/State.cs b/src/slskd/Core/State.cs index 9ae6df6b..86b628b5 100644 --- a/src/slskd/Core/State.cs +++ b/src/slskd/Core/State.cs @@ -35,6 +35,7 @@ namespace slskd public bool PendingReconnect { get; init; } public bool PendingRestart { get; init; } public ServerState Server { get; init; } = new ServerState(); + public ServerConnectionWatchdogState ConnectionWatchdog { get; init; } = new ServerConnectionWatchdogState(); public RelayState Relay { get; init; } = new RelayState(); public UserState User { get; init; } = new UserState(); public DistributedNetworkState DistributedNetwork { get; init; } = new DistributedNetworkState(); @@ -61,10 +62,19 @@ namespace slskd public IPEndPoint IPEndPoint { get; init; } public SoulseekClientStates State { get; init; } public bool IsConnected => State.HasFlag(SoulseekClientStates.Connected); + public bool IsConnecting => State.HasFlag(SoulseekClientStates.Connecting); public bool IsLoggedIn => State.HasFlag(SoulseekClientStates.LoggedIn); + public bool IsLoggingIn => State.HasFlag(SoulseekClientStates.LoggingIn); public bool IsTransitioning => State.HasFlag(SoulseekClientStates.Connecting) || State.HasFlag(SoulseekClientStates.Disconnecting) || State.HasFlag(SoulseekClientStates.LoggingIn); } + public record ServerConnectionWatchdogState + { + public bool IsEnabled { get; init; } = false; + public bool IsAttemptingConnection { get; init; } = false; + public DateTime? NextAttemptAt { get; init; } + } + public record RelayState { public RelayMode Mode { get; init; } |
