peer has full torrent debug message
This commit is contained in:
parent
b60850946e
commit
b60ec6d919
2 changed files with 19 additions and 6 deletions
|
|
@ -1222,6 +1222,13 @@ impl PeerHandler {
|
|||
}
|
||||
};
|
||||
trace!("updated bitfield with have={}", have);
|
||||
if let Some(true) = live
|
||||
.bitfield
|
||||
.get(..self.state.lengths.total_pieces() as usize)
|
||||
.map(|s| s.all())
|
||||
{
|
||||
debug!("peer has full torrent");
|
||||
}
|
||||
});
|
||||
self.on_bitfield_notify.notify_waiters();
|
||||
}
|
||||
|
|
@ -1234,9 +1241,14 @@ impl PeerHandler {
|
|||
self.state.lengths.piece_bitfield_bytes(),
|
||||
);
|
||||
}
|
||||
self.state
|
||||
.peers
|
||||
.update_bitfield_from_vec(self.addr, bitfield.0.to_vec().into_boxed_slice());
|
||||
let bf = BF::from_boxed_slice(bitfield.0.to_vec().into_boxed_slice());
|
||||
if let Some(true) = bf
|
||||
.get(..self.state.lengths.total_pieces() as usize)
|
||||
.map(|s| s.all())
|
||||
{
|
||||
debug!("peer has full torrent");
|
||||
}
|
||||
self.state.peers.update_bitfield(self.addr, bf);
|
||||
self.on_bitfield_notify.notify_waiters();
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,11 +105,12 @@ impl PeerStates {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn update_bitfield_from_vec(&self, handle: PeerHandle, bitfield: Box<[u8]>) -> Option<()> {
|
||||
self.with_live_mut(handle, "update_bitfield_from_vec", |live| {
|
||||
live.bitfield = BF::from_boxed_slice(bitfield);
|
||||
pub fn update_bitfield(&self, handle: PeerHandle, bitfield: BF) -> Option<()> {
|
||||
self.with_live_mut(handle, "update_bitfield", |live| {
|
||||
live.bitfield = bitfield;
|
||||
})
|
||||
}
|
||||
|
||||
pub fn mark_peer_connecting(&self, h: PeerHandle) -> anyhow::Result<(PeerRx, PeerTx)> {
|
||||
let rx = self
|
||||
.with_peer_mut(h, "mark_peer_connecting", |peer| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue