Less spammy log message
This commit is contained in:
parent
5ffe2d59b7
commit
ffc662e370
4 changed files with 13 additions and 9 deletions
|
|
@ -194,10 +194,6 @@ impl ChunkTracker {
|
||||||
.filter_map(|id| self.lengths.validate_piece_index(id))
|
.filter_map(|id| self.lengths.validate_piece_index(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_piece_queued(&self, id: ValidPieceIndex) -> bool {
|
|
||||||
self.queue_pieces[id.get() as usize]
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn is_piece_have(&self, id: ValidPieceIndex) -> bool {
|
pub(crate) fn is_piece_have(&self, id: ValidPieceIndex) -> bool {
|
||||||
self.have[id.get() as usize]
|
self.have[id.get() as usize]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -710,7 +710,9 @@ impl TorrentStateLive {
|
||||||
self.streams.wake_streams_on_piece_completed(id);
|
self.streams.wake_streams_on_piece_completed(id);
|
||||||
|
|
||||||
if self.is_finished() {
|
if self.is_finished() {
|
||||||
info!("torrent finished downloading");
|
if self.lock_read("chunks").get_chunks()?.get_selected_pieces()[id.get_usize()] {
|
||||||
|
info!("torrent finished downloading");
|
||||||
|
}
|
||||||
self.finished_notify.notify_waiters();
|
self.finished_notify.notify_waiters();
|
||||||
|
|
||||||
if !self.has_active_streams_unfinished_files() {
|
if !self.has_active_streams_unfinished_files() {
|
||||||
|
|
|
||||||
|
|
@ -304,16 +304,17 @@ impl ManagedTorrent {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maybe_reconnect_needed_peers_for_file(&self, file_id: usize) {
|
fn maybe_reconnect_needed_peers_for_file(&self, file_id: usize) -> bool {
|
||||||
// If we have the full file, don't bother.
|
// If we have the full file, don't bother.
|
||||||
if let Ok(true) = self.with_opened_file(file_id, |f| f.approx_is_finished()) {
|
if let Ok(true) = self.with_opened_file(file_id, |f| f.approx_is_finished()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
self.with_state(|state| {
|
self.with_state(|state| {
|
||||||
if let crate::ManagedTorrentState::Live(l) = &state {
|
if let crate::ManagedTorrentState::Live(l) = &state {
|
||||||
l.reconnect_all_not_needed_peers();
|
l.reconnect_all_not_needed_peers();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stream(self: Arc<Self>, file_id: usize) -> anyhow::Result<FileStream> {
|
pub fn stream(self: Arc<Self>, file_id: usize) -> anyhow::Result<FileStream> {
|
||||||
|
|
@ -331,7 +332,9 @@ impl ManagedTorrent {
|
||||||
file_torrent_abs_offset: fd_offset,
|
file_torrent_abs_offset: fd_offset,
|
||||||
torrent: self,
|
torrent: self,
|
||||||
};
|
};
|
||||||
s.torrent.maybe_reconnect_needed_peers_for_file(file_id);
|
if s.torrent.maybe_reconnect_needed_peers_for_file(file_id) {
|
||||||
|
s.torrent.with_opened_file(file_id, |f| f.reopen(false))??;
|
||||||
|
}
|
||||||
streams.streams.insert(
|
streams.streams.insert(
|
||||||
s.stream_id,
|
s.stream_id,
|
||||||
StreamState {
|
StreamState {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,9 @@ impl ValidPieceIndex {
|
||||||
pub const fn get(&self) -> u32 {
|
pub const fn get(&self) -> u32 {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
pub const fn get_usize(&self) -> usize {
|
||||||
|
self.0 as usize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Lengths {
|
impl Lengths {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue