fix(dl): take stalled from Transmission

A zero download rate is not a stalled torrent: one between peers reads
zero for a poll or two and finishes fine, and at §9.8's 15s cadence that
flicker would raise the one chip reserved for a download that never
finishes. Transmission already decides this with its own stalled window;
carry isStalled and use it.
This commit is contained in:
Miguel Palhas
2026-08-26 12:27:42 +01:00
parent ad36a0aa83
commit 5ba49edfd4
2 changed files with 14 additions and 3 deletions
+9 -2
View File
@@ -75,6 +75,10 @@ pub struct Torrent {
pub eta: Option<i64>,
/// Transmission's error message, when the torrent has errored.
pub error: Option<String>,
/// Transmission's own verdict that this torrent has gone quiet for longer
/// than its configured stalled window. A rate of zero is not the same
/// fact: a torrent between peers reads zero for one poll and is fine.
pub is_stalled: bool,
pub download_dir: PathBuf,
pub labels: Vec<String>,
/// Transmission has stopped this torrent because its configured seeding
@@ -237,8 +241,8 @@ impl TransmissionClient {
json!({
"fields": [
"id", "name", "hashString", "status", "percentDone",
"rateDownload", "eta", "errorString", "downloadDir",
"labels", "isFinished"
"rateDownload", "eta", "errorString", "isStalled",
"downloadDir", "labels", "isFinished"
]
}),
)
@@ -398,6 +402,8 @@ struct RpcTorrent {
eta: Option<i64>,
#[serde(rename = "errorString", default)]
error: String,
#[serde(rename = "isStalled", default)]
is_stalled: bool,
#[serde(rename = "downloadDir")]
download_dir: PathBuf,
#[serde(default)]
@@ -428,6 +434,7 @@ impl From<RpcTorrent> for Torrent {
download_rate: value.download_rate,
eta: value.eta.filter(|eta| *eta >= 0),
error: (!value.error.is_empty()).then_some(value.error),
is_stalled: value.is_stalled,
download_dir: value.download_dir,
labels: value.labels,
is_finished: value.is_finished,