aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Users/UserService.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs
index 39647e0a..4e252f40 100644
--- a/src/slskd/Users/UserService.cs
+++ b/src/slskd/Users/UserService.cs
@@ -253,7 +253,21 @@ namespace slskd.Users
};
Client.LoggedIn += (_, _) => WatchAllUsers();
- Client.Disconnected += (_, _) => WatchedUsernamesDictionary.Clear();
+ Client.Disconnected += (_, _) =>
+ {
+ // when the client is disconnected, the watched user list resets server-side,
+ // so clear the watched dictionary to reflect this
+ WatchedUsernamesDictionary.Clear();
+
+ // over the course of operation the application will watch users which are not explicitly
+ // configured as they enqueue uploads. these are considered transiently-tracked users,
+ // and we want to discard them upon disconnect to avoid re-watching them when the client
+ // is reconnected. to do this, purge the user dictionary of any entry lacking an explicit group.
+ foreach (var user in UserDictionary.Values.Where(user => user.Group == null))
+ {
+ UserDictionary.TryRemove(user.Username, out _);
+ }
+ };
}
private void Configure(Options options)