Add debug and remove unneeded

This commit is contained in:
Ivan 2024-09-28 19:36:54 +02:00
parent cd7349121c
commit 1ce5971f07

View file

@ -7,6 +7,7 @@ use librqbit_core::hash_id::Id20;
use librqbit_core::lengths::ChunkInfo;
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
use tracing::debug;
use crate::peer_connection::WriterRequest;
use crate::type_aliases::BF;
@ -64,9 +65,14 @@ impl Peer {
OutgoingAddressType::Known(socket_addr) => {
if known_address == socket_addr {
self.state.set(PeerState::Queued, counters);
} else {
debug!(
peer = known_address.to_string(),
"peer will by retried on different address {}", socket_addr
);
}
Some(socket_addr)
},
}
}
} else {
None
@ -174,14 +180,6 @@ impl PeerStateNoMut {
}
}
pub fn not_needed_to_queued(&mut self, counters: &[&AggregatePeerStatsAtomic]) -> bool {
if let PeerState::NotNeeded = &self.0 {
self.set(PeerState::Queued, counters);
return true;
}
false
}
pub fn incoming_connection(
&mut self,
peer_id: Id20,