diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-05-17 09:11:26 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-05-17 09:11:26 -0500 |
| commit | 571f99876be90121c0cfa882d50c8a901d1635a6 (patch) | |
| tree | 68f17fc4b88bdf2390e6f5423538570a2998ca91 /src/slskd/Trackers | |
| parent | 2655fe1c7c80df98f0fee32fc9d63323f106a373 (diff) | |
| download | slskd-571f99876be90121c0cfa882d50c8a901d1635a6.tar.gz | |
fix warnings
Diffstat (limited to 'src/slskd/Trackers')
| -rw-r--r-- | src/slskd/Trackers/IBrowseTracker.cs | 35 | ||||
| -rw-r--r-- | src/slskd/Trackers/IRoomTracker.cs | 25 | ||||
| -rw-r--r-- | src/slskd/Trackers/RoomTracker.cs | 22 | ||||
| -rw-r--r-- | src/slskd/Trackers/TransferTracker.cs | 16 |
4 files changed, 71 insertions, 27 deletions
diff --git a/src/slskd/Trackers/IBrowseTracker.cs b/src/slskd/Trackers/IBrowseTracker.cs index 89396143..f7607e2b 100644 --- a/src/slskd/Trackers/IBrowseTracker.cs +++ b/src/slskd/Trackers/IBrowseTracker.cs @@ -1,7 +1,24 @@ -namespace slskd.Trackers +// <copyright file="IBrowseTracker.cs" company="slskd Team"> +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// </copyright> + +namespace slskd.Trackers { - using Soulseek; using System.Collections.Concurrent; + using Soulseek; /// <summary> /// Tracks browse operations. @@ -21,17 +38,17 @@ void AddOrUpdate(string username, BrowseProgressUpdatedEventArgs progress); /// <summary> - /// Removes a tracked browse operation for the specified user. - /// </summary> - /// <param name="username"></param> - void TryRemove(string username); - - /// <summary> /// Gets the browse progress for the specified user. /// </summary> /// <param name="username"></param> /// <param name="progress"></param> /// <returns></returns> bool TryGet(string username, out BrowseProgressUpdatedEventArgs progress); + + /// <summary> + /// Removes a tracked browse operation for the specified user. + /// </summary> + /// <param name="username"></param> + void TryRemove(string username); } -} +}
\ No newline at end of file diff --git a/src/slskd/Trackers/IRoomTracker.cs b/src/slskd/Trackers/IRoomTracker.cs index fe768910..bbeb8255 100644 --- a/src/slskd/Trackers/IRoomTracker.cs +++ b/src/slskd/Trackers/IRoomTracker.cs @@ -1,8 +1,25 @@ -namespace slskd.Trackers +// <copyright file="IRoomTracker.cs" company="slskd Team"> +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// </copyright> + +namespace slskd.Trackers { - using Soulseek; using System.Collections.Concurrent; using slskd.Entities; + using Soulseek; /// <summary> /// Tracks rooms. @@ -10,7 +27,7 @@ public interface IRoomTracker { /// <summary> - /// Tracked rooms. + /// Gets tracked rooms. /// </summary> ConcurrentDictionary<string, Room> Rooms { get; } @@ -22,7 +39,7 @@ void AddOrUpdateMessage(string roomName, RoomMessage message); /// <summary> - /// Adds the specified room to the tracker + /// Adds the specified room to the tracker. /// </summary> /// <param name="roomName"></param> /// <param name="room"></param> diff --git a/src/slskd/Trackers/RoomTracker.cs b/src/slskd/Trackers/RoomTracker.cs index 3eec1f24..ba4922b9 100644 --- a/src/slskd/Trackers/RoomTracker.cs +++ b/src/slskd/Trackers/RoomTracker.cs @@ -1,10 +1,27 @@ -namespace slskd.Trackers +// <copyright file="RoomTracker.cs" company="slskd Team"> +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// </copyright> + +namespace slskd.Trackers { - using Soulseek; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using slskd.Entities; + using Soulseek; /// <summary> /// Tracks rooms. @@ -77,7 +94,6 @@ /// Returns the list of messages for the specified <paramref name="roomName"/>, if it is tracked. /// </summary> /// <param name="roomName"></param> - /// <returns></returns> public void TryRemove(string roomName) => Rooms.TryRemove(roomName, out _); /// <summary> diff --git a/src/slskd/Trackers/TransferTracker.cs b/src/slskd/Trackers/TransferTracker.cs index 270f25cb..a3911ff5 100644 --- a/src/slskd/Trackers/TransferTracker.cs +++ b/src/slskd/Trackers/TransferTracker.cs @@ -54,7 +54,7 @@ namespace slskd.Trackers Username = u.Key, Directories = u.Value.Values .GroupBy(f => f.Transfer.Filename.DirectoryName()) - .Select(d => new { Directory = d.Key, Files = d.Select(r => r.Transfer)}) + .Select(d => new { Directory = d.Key, Files = d.Select(r => r.Transfer) }), }); } @@ -81,7 +81,7 @@ namespace slskd.Trackers { return userTransfers.Values .GroupBy(f => f.Transfer.Filename.DirectoryName()) - .Select(d => new { Directory = d.Key, Files = d.Select(r => r.Transfer)}); + .Select(d => new { Directory = d.Key, Files = d.Select(r => r.Transfer) }); } /// <summary> @@ -105,7 +105,7 @@ namespace slskd.Trackers public class TransferTracker : ITransferTracker { /// <summary> - /// Tracked transfers. + /// Gets tracked transfers. /// </summary> public ConcurrentDictionary<TransferDirection, ConcurrentDictionary<string, ConcurrentDictionary<string, (API.DTO.Transfer Transfer, CancellationTokenSource CancellationTokenSource)>>> Transfers { get; private set; } = new ConcurrentDictionary<TransferDirection, ConcurrentDictionary<string, ConcurrentDictionary<string, (API.DTO.Transfer, CancellationTokenSource)>>>(); @@ -172,15 +172,9 @@ namespace slskd.Trackers { transfer = default; - if (Transfers.TryGetValue(direction, out var transfers)) + if (Transfers.TryGetValue(direction, out var transfers) && transfers.TryGetValue(username, out var user) && user.TryGetValue(id, out transfer)) { - if (transfers.TryGetValue(username, out var user)) - { - if (user.TryGetValue(id, out transfer)) - { - return true; - } - } + return true; } return false; |
