From 5d802f45166fea9f4986d46428ec21bf27474721 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 14 Mar 2022 08:02:30 -0500 Subject: add DistributedNetworkState --- src/slskd/State.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/slskd/State.cs b/src/slskd/State.cs index bd82f8d7..71807728 100644 --- a/src/slskd/State.cs +++ b/src/slskd/State.cs @@ -18,6 +18,7 @@ namespace slskd { using System; + using System.Collections.Generic; using System.Net; using System.Text.Json.Serialization; using slskd.Users; @@ -33,6 +34,7 @@ namespace slskd public bool PendingRestart { get; init; } public bool PendingShareRescan { get; init; } public ServerState Server { get; init; } = new ServerState(); + public DistributedNetworkState DistributedNetwork { get; init; } = new DistributedNetworkState(); public SharedFileCacheState SharedFileCache { get; init; } = new SharedFileCacheState(); public string[] Rooms { get; init; } = Array.Empty(); public User[] Users { get; init; } = Array.Empty(); @@ -61,6 +63,18 @@ namespace slskd public bool IsTransitioning => State.HasFlag(SoulseekClientStates.Connecting) || State.HasFlag(SoulseekClientStates.Disconnecting) || State.HasFlag(SoulseekClientStates.LoggingIn); } + public record DistributedNetworkState + { + public int BranchLevel { get; init; } + public string BranchRoot { get; init; } + public bool CanAcceptChildren { get; init; } + public int ChildLimit { get; init; } + public IReadOnlyCollection<(string Username, IPEndPoint IPEndPoint)> Children { get; init; } + public bool HasParent { get; init; } + public bool IsBranchRoot { get; init; } + public (string Username, IPEndPoint IPEndPoint) Parent { get; init; } + } + /// /// Share cache state. /// -- cgit v1.2.3