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:
@@ -116,7 +116,10 @@ fn phase(torrent: &Torrent) -> DownloadPhase {
|
||||
} else {
|
||||
match torrent.state {
|
||||
TorrentState::Seeding => DownloadPhase::Seeding,
|
||||
TorrentState::Downloading if torrent.download_rate == 0 => DownloadPhase::Stalled,
|
||||
// Transmission's own verdict, not a zero rate: a torrent between
|
||||
// peers reads zero for a poll or two and finishes fine, and
|
||||
// §9.8's stalled chip is for the case that never does.
|
||||
TorrentState::Downloading if torrent.is_stalled => DownloadPhase::Stalled,
|
||||
TorrentState::Downloading => DownloadPhase::Downloading,
|
||||
_ => DownloadPhase::Queued,
|
||||
}
|
||||
@@ -148,6 +151,7 @@ mod tests {
|
||||
download_rate: rate,
|
||||
eta: None,
|
||||
error: error.map(str::to_owned),
|
||||
is_stalled: rate == 0,
|
||||
download_dir: PathBuf::from("/downloads"),
|
||||
labels: Vec::new(),
|
||||
is_finished: false,
|
||||
|
||||
Reference in New Issue
Block a user