aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Shares/ShareService.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-06-02 07:28:10 -0500
committerJP Dillingham <jp@dillingham.me>2022-06-02 07:28:10 -0500
commit2efd8278ce9a5a895fe0c75bd95080ecc386163b (patch)
tree4637e61c969639df8475ed6bb4aeac5437c35b64 /src/slskd/Shares/ShareService.cs
parentcbffe2d38e5b7b0831eeacff7ba1ef7973f4f85c (diff)
downloadslskd-2efd8278ce9a5a895fe0c75bd95080ecc386163b.tar.gz
differentiate configured shares vs cached shares
Diffstat (limited to 'src/slskd/Shares/ShareService.cs')
-rw-r--r--src/slskd/Shares/ShareService.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs
index 9cae0d42..ead96d10 100644
--- a/src/slskd/Shares/ShareService.cs
+++ b/src/slskd/Shares/ShareService.cs
@@ -55,6 +55,11 @@ namespace slskd.Shares
Directories = current.Directories,
Files = current.Files,
});
+
+ if (previous.Filling && !current.Filling)
+ {
+ CachedShares = current.Shares.ToList().AsReadOnly();
+ }
});
OptionsMonitor = optionsMonitor;
@@ -68,7 +73,10 @@ namespace slskd.Shares
/// </summary>
public IReadOnlyList<Share> Shares => SharesList.AsReadOnly();
- public IReadOnlyList<Regex> FilterRegexes => FilterRegexList.AsReadOnly();
+ /// <summary>
+ /// Gets the list of shares stored in the cache.
+ /// </summary>
+ public IReadOnlyList<Share> CachedShares { get; private set; } = new List<Share>().AsReadOnly();
/// <summary>
/// Gets the state monitor for the service.
@@ -81,7 +89,7 @@ namespace slskd.Shares
private List<Share> SharesList { get; set; } = new List<Share>();
private IManagedState<ShareState> State { get; } = new ManagedState<ShareState>();
private SemaphoreSlim SyncRoot { get; } = new SemaphoreSlim(1, 1);
- private List<Regex> FilterRegexList { get; set; } = new List<Regex>();
+ private List<Regex> FilterRegexes { get; set; } = new List<Regex>();
/// <summary>
/// Returns the entire contents of the share.
@@ -160,7 +168,7 @@ namespace slskd.Shares
.ToList();
SharesList = shares;
- FilterRegexList = regexes;
+ FilterRegexes = regexes;
State.SetValue(state => state with { ScanPending = true });