diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-10-30 12:40:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-30 12:40:00 -0500 |
| commit | 8624a5387b6db17141fa6bb7601b1490c1f95c30 (patch) | |
| tree | b2264599945ff634f25286c485ee2848db7287e8 /src/slskd/Network/NetworkService.cs | |
| parent | 915ed6aa255636cfd339e9b53b4da202a3799f98 (diff) | |
| parent | dbe3a9e82036a0db8049f3b884342dc98cc98d58 (diff) | |
| download | slskd-8624a5387b6db17141fa6bb7601b1490c1f95c30.tar.gz | |
Merge branch 'master' into secret-gen
Diffstat (limited to 'src/slskd/Network/NetworkService.cs')
| -rw-r--r-- | src/slskd/Network/NetworkService.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/slskd/Network/NetworkService.cs b/src/slskd/Network/NetworkService.cs index 7dbd79cd..44628e1b 100644 --- a/src/slskd/Network/NetworkService.cs +++ b/src/slskd/Network/NetworkService.cs @@ -54,13 +54,12 @@ namespace slskd.Network /// <summary> /// Retrieves a new share upload token for the specified <paramref name="agentName"/>. /// </summary> - /// <remarks>The token is cached internally, and is only valid while it remains in the cache.</remarks> /// <remarks> /// <para>This is the first step in a multi-step workflow. The entire sequence is:</para> /// <list type="number"> /// <item> /// A remote agent makes a request to the SignalR hub to retrieve a share upload token, which in turn - /// calls <see cref="GenerateShareUploadToken"/>. The token is generated and cached. + /// calls <see cref="GenerateShareUploadToken"/>. The token is generated and cached, and is only valid while it is in the cache. /// </item> /// <item> /// The remote agent makes an HTTP POST request containing a multipart upload including a backup of its @@ -313,7 +312,8 @@ namespace slskd.Network { var token = Guid.NewGuid(); - MemoryCache.Set(GetShareTokenCacheKey(token), agentName, TimeSpan.FromMinutes(1)); + // allow a generous amount of time, in case it takes a while to upload the response + MemoryCache.Set(GetShareTokenCacheKey(token), agentName, TimeSpan.FromMinutes(5)); Log.Debug("Cached share upload token {Token} for agent {Agent}", token, agentName); return token; @@ -427,7 +427,7 @@ namespace slskd.Network var key = new WaitKey(nameof(GetFileStreamAsync), agentName, id); var wait = Waiter.Wait<Stream>(key, timeout, cancellationToken); - await NetworkHub.Clients.Client(record.ConnectionId).RequestFile(filename, id); + await NetworkHub.Clients.Client(record.ConnectionId).RequestFileUpload(filename, id); Log.Information("Requested file {Filename} from Agent {Agent} with ID {Id}. Waiting for incoming connection.", filename, agentName, id); var task = await Task.WhenAny(wait, Task.Delay(timeout, cancellationToken)); |
