diff --git a/client/src/app/models/download.model.ts b/client/src/app/models/download.model.ts
index 204b175..f95524b 100644
--- a/client/src/app/models/download.model.ts
+++ b/client/src/app/models/download.model.ts
@@ -15,4 +15,5 @@ export class Download {
public bytesTotal: number;
public bytesDone: number;
public speed: number;
+ public retryCount: number;
}
diff --git a/client/src/app/models/torrent.model.ts b/client/src/app/models/torrent.model.ts
index 35abb6f..b640ffb 100644
--- a/client/src/app/models/torrent.model.ts
+++ b/client/src/app/models/torrent.model.ts
@@ -16,6 +16,8 @@ export class Torrent {
public fileOrMagnet: string;
public isFile: boolean;
+ public retryCount: number;
+
public rdId: string;
public rdName: string;
public rdSize: number;
diff --git a/client/src/app/torrent/torrent.component.html b/client/src/app/torrent/torrent.component.html
index 41a4cf9..1d4b6f7 100644
--- a/client/src/app/torrent/torrent.component.html
+++ b/client/src/app/torrent/torrent.component.html
@@ -32,6 +32,10 @@
{{ torrent | status }}
+
+
+ {{ torrent.retryCount }} / 2
+
{{ torrent.hash }}
@@ -245,7 +249,7 @@
- {{ download.retryCount }}
+ {{ download.retryCount }} / 3
diff --git a/server/RdtClient.Service/Services/TorrentRunner.cs b/server/RdtClient.Service/Services/TorrentRunner.cs
index b9b5f75..6a40ea0 100644
--- a/server/RdtClient.Service/Services/TorrentRunner.cs
+++ b/server/RdtClient.Service/Services/TorrentRunner.cs
@@ -115,7 +115,10 @@ namespace RdtClient.Service.Services
{
Log.Debug($"Processing active download {downloadId}: error {downloadClient.Error}, download retry count {download.RetryCount}/{DownloadRetryCount}, torrent retry count {download.Torrent.RetryCount}/{TorrentRetryCount}, retrying torrent");
- await _torrents.RetryTorrent(download.TorrentId);
+ Task.Run(async () =>
+ {
+ await _torrents.RetryTorrent(download.TorrentId);
+ });
}
else
{
diff --git a/server/RdtClient.Service/Services/Torrents.cs b/server/RdtClient.Service/Services/Torrents.cs
index c470f98..c98efda 100644
--- a/server/RdtClient.Service/Services/Torrents.cs
+++ b/server/RdtClient.Service/Services/Torrents.cs
@@ -101,12 +101,12 @@ namespace RdtClient.Service.Services
await _torrentData.UpdateCategory(torrent.TorrentId, category);
}
- public async Task UploadMagnet(String magnetLink,
- String category,
- TorrentDownloadAction downloadAction,
- TorrentFinishedAction finishedAction,
- Int32 downloadMinSize,
- String downloadManualFiles)
+ public async Task UploadMagnet(String magnetLink,
+ String category,
+ TorrentDownloadAction downloadAction,
+ TorrentFinishedAction finishedAction,
+ Int32 downloadMinSize,
+ String downloadManualFiles)
{
MagnetLink magnet;
@@ -121,15 +121,15 @@ namespace RdtClient.Service.Services
var rdTorrent = await GetRdNetClient().Torrents.AddMagnetAsync(magnetLink);
- await Add(rdTorrent.Id, magnet.InfoHash.ToHex(), category, downloadAction, finishedAction, downloadMinSize, downloadManualFiles, magnetLink, false);
+ return await Add(rdTorrent.Id, magnet.InfoHash.ToHex(), category, downloadAction, finishedAction, downloadMinSize, downloadManualFiles, magnetLink, false);
}
- public async Task UploadFile(Byte[] bytes,
- String category,
- TorrentDownloadAction downloadAction,
- TorrentFinishedAction finishedAction,
- Int32 downloadMinSize,
- String downloadManualFiles)
+ public async Task UploadFile(Byte[] bytes,
+ String category,
+ TorrentDownloadAction downloadAction,
+ TorrentFinishedAction finishedAction,
+ Int32 downloadMinSize,
+ String downloadManualFiles)
{
MonoTorrent.Torrent torrent;
@@ -146,7 +146,7 @@ namespace RdtClient.Service.Services
var rdTorrent = await GetRdNetClient().Torrents.AddFileAsync(bytes);
- await Add(rdTorrent.Id, torrent.InfoHash.ToHex(), category, downloadAction, finishedAction, downloadMinSize, downloadManualFiles, fileAsBase64, true);
+ return await Add(rdTorrent.Id, torrent.InfoHash.ToHex(), category, downloadAction, finishedAction, downloadMinSize, downloadManualFiles, fileAsBase64, true);
}
public async Task> GetAvailableFiles(String hash)
@@ -394,14 +394,14 @@ namespace RdtClient.Service.Services
{
downloadClient.Cancel();
- await Task.Delay(1000);
+ await Task.Delay(100);
}
while (TorrentRunner.ActiveUnpackClients.TryGetValue(download.DownloadId, out var unpackClient))
{
unpackClient.Cancel();
- await Task.Delay(1000);
+ await Task.Delay(100);
}
}
@@ -416,23 +416,25 @@ namespace RdtClient.Service.Services
try
{
+ Torrent newTorrent;
+
if (torrent.IsFile)
{
var bytes = Convert.FromBase64String(torrent.FileOrMagnet);
- await UploadFile(bytes, torrent.Category, torrent.DownloadAction, torrent.FinishedAction, torrent.DownloadMinSize, torrent.DownloadManualFiles);
+ newTorrent = await UploadFile(bytes, torrent.Category, torrent.DownloadAction, torrent.FinishedAction, torrent.DownloadMinSize, torrent.DownloadManualFiles);
}
else
{
- await UploadMagnet(torrent.FileOrMagnet,
- torrent.Category,
- torrent.DownloadAction,
- torrent.FinishedAction,
- torrent.DownloadMinSize,
- torrent.DownloadManualFiles);
+ newTorrent = await UploadMagnet(torrent.FileOrMagnet,
+ torrent.Category,
+ torrent.DownloadAction,
+ torrent.FinishedAction,
+ torrent.DownloadMinSize,
+ torrent.DownloadManualFiles);
}
- await _torrentData.UpdateRetryCount(torrent.TorrentId, newRetryCount);
+ await _torrentData.UpdateRetryCount(newTorrent.TorrentId, newRetryCount);
}
finally
{
@@ -530,15 +532,15 @@ namespace RdtClient.Service.Services
return settingDownloadPath;
}
- private async Task Add(String rdTorrentId,
- String infoHash,
- String category,
- TorrentDownloadAction downloadAction,
- TorrentFinishedAction finishedAction,
- Int32 downloadMinSize,
- String downloadManualFiles,
- String fileOrMagnetContents,
- Boolean isFile)
+ private async Task Add(String rdTorrentId,
+ String infoHash,
+ String category,
+ TorrentDownloadAction downloadAction,
+ TorrentFinishedAction finishedAction,
+ Int32 downloadMinSize,
+ String downloadManualFiles,
+ String fileOrMagnetContents,
+ Boolean isFile)
{
await RealDebridUpdateLock.WaitAsync();
@@ -548,7 +550,7 @@ namespace RdtClient.Service.Services
if (torrent != null)
{
- return;
+ return torrent;
}
var newTorrent = await _torrentData.Add(rdTorrentId,
@@ -562,6 +564,8 @@ namespace RdtClient.Service.Services
isFile);
await Update(newTorrent);
+
+ return newTorrent;
}
finally
{