diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-12-31 16:45:44 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2023-12-31 16:45:44 -0600 |
| commit | b42d1fea954ebc93ecd5a8451db469af1cc76795 (patch) | |
| tree | 6eafea9da08a5209cbd1c59c1579ce2e5777246a /src/slskd/Transfers | |
| parent | e01ead54fab085b8cf8d6f4bf92592a57b6b2d65 (diff) | |
| download | slskd-b42d1fea954ebc93ecd5a8451db469af1cc76795.tar.gz | |
rename GetGroup to ResolveGroup, allow stats and status to be passed in
Diffstat (limited to 'src/slskd/Transfers')
| -rw-r--r-- | src/slskd/Transfers/Uploads/UploadQueue.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadQueue.cs b/src/slskd/Transfers/Uploads/UploadQueue.cs index 53e135e8..0b5f51b1 100644 --- a/src/slskd/Transfers/Uploads/UploadQueue.cs +++ b/src/slskd/Transfers/Uploads/UploadQueue.cs @@ -254,11 +254,11 @@ namespace slskd.Transfers /// <exception cref="NotFoundException">Thrown if the specified filename is not enqueued.</exception> public int EstimatePosition(string username, string filename) { - var groupName = Users.GetGroup(username); + var groupName = Users.ResolveGroup(username); var groupRecord = Groups.GetValueOrDefault(groupName); // the Uploads dictionary is keyed by username; gather all of the users that belong to the same group as the requested user - var uploadsForGroup = Uploads.Where(kvp => Users.GetGroup(kvp.Key) == groupName); + var uploadsForGroup = Uploads.Where(kvp => Users.ResolveGroup(kvp.Key) == groupName); // the RoundRobin queue implementation is not strictly fair to all users; only uploads that are ready are candidates // for selection. this means that if Bob downloads files twice as fast as Alice, Bob is going to advance through the @@ -337,7 +337,7 @@ namespace slskd.Transfers /// </returns> public int ForecastPosition(string username) { - var groupName = Users.GetGroup(username); + var groupName = Users.ResolveGroup(username); // if there's a slot available, the user will enter the queue at position 0 (will start immediately) if (Groups.TryGetValue(groupName, out var groupRecord) && groupRecord.SlotAvailable) @@ -346,7 +346,7 @@ namespace slskd.Transfers } // the Uploads dictionary is keyed by username; gather all of the users that belong to the same group as the requested user - var uploadsForGroup = Uploads.Where(kvp => Users.GetGroup(kvp.Key) == groupName); + var uploadsForGroup = Uploads.Where(kvp => Users.ResolveGroup(kvp.Key) == groupName); // assuming that the queue will be processed in a true round-robin fashion and that the user will be the last in the // rotation (worst case), the user's start position will be equal to the number of users downloading or waiting, + 1. @@ -462,7 +462,7 @@ namespace slskd.Transfers if (ready.Any()) { - var group = Users.GetGroup(user.Key); + var group = Users.ResolveGroup(user.Key); groups.AddOrUpdate( key: group, |
