aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Relay/RelayService.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-01-07 18:54:29 -0600
committerGitHub <noreply@github.com>2023-01-07 18:54:29 -0600
commitff5f0ac6c93f2b49ba259e7093fb92fa873116c6 (patch)
tree89a57703213c524f09346aac4fcf3a9ee8b3cf04 /src/slskd/Relay/RelayService.cs
parentd5eabb72a5c5a3aed06f0c4b8f66c853468b889b (diff)
parentf07a7758b47388c793d73ca54727db95abfcd229 (diff)
downloadslskd-ff5f0ac6c93f2b49ba259e7093fb92fa873116c6.tar.gz
Merge pull request #827 from slskd/relay-debug
Miscellaneous Relay refactoring and bugfixes
Diffstat (limited to 'src/slskd/Relay/RelayService.cs')
-rw-r--r--src/slskd/Relay/RelayService.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs
index 47879b19..1dda50c2 100644
--- a/src/slskd/Relay/RelayService.cs
+++ b/src/slskd/Relay/RelayService.cs
@@ -456,7 +456,7 @@ namespace slskd.Relay
var key = new WaitKey(nameof(GetFileInfoAsync), agentName, id);
var wait = Waiter.Wait<(bool Exists, long Length)>(key, timeout);
- Log.Information("Created wait {Key}", key);
+ Log.Debug("Created wait {Key}", key);
try
{
@@ -624,6 +624,8 @@ namespace slskd.Relay
/// <returns>The operation context.</returns>
public Task HandleShareUpload(string agentName, Guid id, IEnumerable<Share> shares, string filename)
{
+ Log.Information("Loading shares from agent {Agent}", agentName);
+
using var repository = ShareRepositoryFactory.CreateFromFile(filename);
if (!repository.TryValidate(out var problems))
@@ -637,6 +639,8 @@ namespace slskd.Relay
Shares.AddOrUpdateHost(new Host(agentName, shares));
+ Log.Information("Shares from agent {Agent} ready.", agentName);
+
return Task.CompletedTask;
}
@@ -694,8 +698,12 @@ namespace slskd.Relay
if (TryGetAgentRegistration(connectionId, out var found))
{
+ Log.Information("Unloading shares for agent {Agent}", found.Agent.Name);
+
Shares.TryRemoveHost(found.Agent.Name);
removed = RegisteredAgentDictionary.TryRemove(found.Agent.Name, out record);
+
+ Log.Information("Shares for agent {Agent} unloaded", found.Agent.Name);
}
State.SetValue(state => state with { Agents = RegisteredAgents });