Skip to content

feat: optimize log of the interested pieces #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions dragonfly-client/src/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ impl Task {
return Err(err);
}
};
info!("interested pieces: {:?}", interested_pieces);
info!(
"interested pieces: {:?}",
interested_pieces
.iter()
.map(|p| p.number)
.collect::<Vec<u32>>()
);

// Construct the pieces for the download task started response.
let mut pieces = Vec::new();
Expand Down Expand Up @@ -338,6 +344,9 @@ impl Task {
info!(
"interested pieces after removing the finished piece: {:?}",
interested_pieces
.iter()
.map(|p| p.number)
.collect::<Vec<u32>>()
);

// Check if all pieces are downloaded.
Expand Down Expand Up @@ -552,7 +561,14 @@ impl Task {
}
announce_peer_response::Response::NormalTaskResponse(response) => {
// If the task is normal, download the pieces from the remote peer.
info!("normal task response: {:?}", response);
info!(
"normal task response: {:?}",
response
.candidate_parents
.iter()
.map(|p| p.id.clone())
.collect::<Vec<String>>()
);

// Send the download peer started request.
in_stream_tx
Expand Down
15 changes: 12 additions & 3 deletions dragonfly-client/src/task/piece.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,13 @@ impl Piece {
}

info!(
"calculate interested pieces by range: {:?}, {:?}",
range, pieces
"calculate interested pieces by range: {:?}, piece length: {:?}. pieces: {:?}",
range,
piece_length,
pieces
.iter()
.map(|piece| piece.number)
.collect::<Vec<u32>>()
);
return Ok(pieces);
}
Expand Down Expand Up @@ -194,8 +199,12 @@ impl Piece {
}

info!(
"calculate interested pieces by content length: {:?}",
"calculate interested pieces by content length, piece length: {:?}, pieces: {:?}",
piece_length,
pieces
.iter()
.map(|piece| piece.number)
.collect::<Vec<u32>>()
);
Ok(pieces)
}
Expand Down