disconnect peers that send bad data
This commit is contained in:
parent
cee66309d0
commit
ef44f104a5
1 changed files with 5 additions and 1 deletions
|
|
@ -1397,11 +1397,15 @@ impl PeerHandler {
|
|||
self.state.maybe_transmit_haves(chunk_info.piece_index);
|
||||
}
|
||||
false => {
|
||||
warn!("checksum for piece={} did not validate", index,);
|
||||
warn!(
|
||||
"checksum for piece={} did not validate. disconecting peer.",
|
||||
index
|
||||
);
|
||||
self.state
|
||||
.lock_write("mark_piece_broken")
|
||||
.get_chunks_mut()?
|
||||
.mark_piece_broken_if_not_have(chunk_info.piece_index);
|
||||
anyhow::bail!("i am probably a bogus peer. dying.")
|
||||
}
|
||||
};
|
||||
Ok::<_, anyhow::Error>(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue