aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-03-14 08:02:40 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-03-14 08:02:40 -0500
commite76c22000ae02e01cefd21d17e06817c1eeb78a4 (patch)
tree0acb0da05fb81279f3131db715a179f1a8730f0c /src
parent5d802f45166fea9f4986d46428ec21bf27474721 (diff)
downloadslskd-e76c22000ae02e01cefd21d17e06817c1eeb78a4.tar.gz
handle DistributedNetworkStateChanged
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 6d874f97..4ae5ea6d 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -136,6 +136,7 @@ namespace slskd
Client.Connected += Client_Connected;
Client.LoggedIn += Client_LoggedIn;
Client.StateChanged += Client_StateChanged;
+ Client.DistributedNetworkStateChanged += Client_DistributedNetworkStateChanged;
Client.DownloadDenied += (e, args) => Log.Information("Download of {Filename} from {Username} was denied: {Message}", args.Filename, args.Username, args.Message);
Client.DownloadFailed += (e, args) => Log.Information("Download of {Filename} from {Username} failed", args.Filename, args.Username);
}
@@ -483,7 +484,34 @@ namespace slskd
private void Client_StateChanged(object sender, SoulseekClientStateChangedEventArgs e)
{
- State.SetValue(state => state with { Server = state.Server with { Address = Client.Address, IPEndPoint = Client.IPEndPoint, State = Client.State, Username = Client.Username } });
+ State.SetValue(state => state with
+ {
+ Server = state.Server with
+ {
+ Address = Client.Address,
+ IPEndPoint = Client.IPEndPoint,
+ State = Client.State,
+ Username = Client.Username,
+ },
+ });
+ }
+
+ private void Client_DistributedNetworkStateChanged(object sender, DistributedNetworkInfo e)
+ {
+ State.SetValue(state => state with
+ {
+ DistributedNetwork = new DistributedNetworkState()
+ {
+ BranchLevel = e.BranchLevel,
+ BranchRoot = e.BranchRoot,
+ CanAcceptChildren = e.CanAcceptChildren,
+ ChildLimit = e.ChildLimit,
+ Children = e.Children,
+ HasParent = e.HasParent,
+ IsBranchRoot = e.IsBranchRoot,
+ Parent = e.Parent,
+ },
+ });
}
private void Client_TransferProgressUpdated(object sender, TransferProgressUpdatedEventArgs args)