This commit is contained in:
Igor Katson 2021-06-27 08:44:25 +01:00
parent 5c5cf3c24a
commit 7fc41fd953
2 changed files with 3 additions and 14 deletions

View file

@ -1,5 +1,5 @@
- [ ] Selective file downloading (mostly done) - [x] Selective file downloading (mostly done)
- [ ] Proper counting of how much is left, and how much is downloaded - [x] Proper counting of how much is left, and how much is downloaded
- [x] Send bitfield at the start if I have something - [x] Send bitfield at the start if I have something
- [x] use the "update_hash" function in piece checking - [x] use the "update_hash" function in piece checking

View file

@ -1225,18 +1225,7 @@ impl TorrentManager {
} }
Ok(response.interval) Ok(response.interval)
} }
fn get_total(&self) -> u64 {
if let Some(length) = self.inner.torrent.info.length {
return length;
}
self.inner
.torrent
.info
.files
.as_ref()
.map(|files| files.iter().map(|f| f.length).sum())
.unwrap_or_default()
}
fn get_left_to_download(&self) -> u64 { fn get_left_to_download(&self) -> u64 {
self.inner.needed - self.get_downloaded() self.inner.needed - self.get_downloaded()
} }