Works pretty well now!
This commit is contained in:
parent
ffc662e370
commit
9474a6d52e
2 changed files with 13 additions and 5 deletions
|
|
@ -740,11 +740,11 @@ impl TorrentStateLive {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reconnect_all_not_needed_peers(&self) {
|
pub(crate) fn reconnect_all_not_needed_peers(&self) {
|
||||||
for pe in self.peers.states.iter() {
|
for mut pe in self.peers.states.iter_mut() {
|
||||||
if let PeerState::NotNeeded = pe.value().state.get() {
|
if pe.state.not_needed_to_queued(&self.peers.stats)
|
||||||
if self.peer_queue_tx.send(*pe.key()).is_err() {
|
&& self.peer_queue_tx.send(*pe.key()).is_err()
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,14 @@ 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(
|
pub fn incoming_connection(
|
||||||
&mut self,
|
&mut self,
|
||||||
peer_id: Id20,
|
peer_id: Id20,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue