diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-09-07 09:22:41 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-09-07 09:22:41 -0500 |
| commit | df9c36569be549934f9bc9e24eb9dd5f003bb19a (patch) | |
| tree | be00f2eb255206cf3976b2a504d218a13ea2c2d8 /src | |
| parent | 0a064353c88a09de05039a4f48cb7fbdeb5ccd51 (diff) | |
| download | slskd-df9c36569be549934f9bc9e24eb9dd5f003bb19a.tar.gz | |
update server state when client state changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application/Application.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/slskd/Application/Application.cs b/src/slskd/Application/Application.cs index 59abcaaf..aa593679 100644 --- a/src/slskd/Application/Application.cs +++ b/src/slskd/Application/Application.cs @@ -134,6 +134,7 @@ namespace slskd Client.Disconnected += Client_Disconnected; Client.Connected += Client_Connected; Client.LoggedIn += Client_LoggedIn; + Client.StateChanged += Client_StateChanged; SoulseekClient = Client; } @@ -421,6 +422,11 @@ namespace slskd logger.Write(TranslateLogLevel(args.Level), "{@Message}", args.Message); } + private void Client_StateChanged(object sender, SoulseekClientStateChangedEventArgs e) + { + StateMonitor.SetValue(state => state with { Server = new ServerState() { Address = Client.Address, IPEndPoint = Client.IPEndPoint, State = Client.State, Username = Client.Username } }); + } + private void Client_Connected(object sender, EventArgs e) { Logger.Information("Connected to the Soulseek server"); |
