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) {
|
||||
for pe in self.peers.states.iter() {
|
||||
if let PeerState::NotNeeded = pe.value().state.get() {
|
||||
if self.peer_queue_tx.send(*pe.key()).is_err() {
|
||||
return;
|
||||
}
|
||||
for mut pe in self.peers.states.iter_mut() {
|
||||
if pe.state.not_needed_to_queued(&self.peers.stats)
|
||||
&& self.peer_queue_tx.send(*pe.key()).is_err()
|
||||
{
|
||||
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(
|
||||
&mut self,
|
||||
peer_id: Id20,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue